summaryrefslogtreecommitdiff
path: root/vendor/phar-io/manifest/src/values
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-03-22 12:24:31 +0300
committerAndrew Dolgov <[email protected]>2022-03-22 12:24:31 +0300
commit1c4f7ab3b838b23afb2ee4dab14acbf75956e952 (patch)
tree0a19274107d717efe92d2c0376cd3105fead5a11 /vendor/phar-io/manifest/src/values
parent711662948768492e8d05b778a7d80eacaec368d2 (diff)
* add phpunit as a dev dependency
* add some basic tests for UrlHelper::rewrite_relative() * fix UrlHelper::rewrite_relative() to work better on non-absolute relative URL paths
Diffstat (limited to 'vendor/phar-io/manifest/src/values')
-rw-r--r--vendor/phar-io/manifest/src/values/Application.php16
-rw-r--r--vendor/phar-io/manifest/src/values/ApplicationName.php37
-rw-r--r--vendor/phar-io/manifest/src/values/Author.php39
-rw-r--r--vendor/phar-io/manifest/src/values/AuthorCollection.php34
-rw-r--r--vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php42
-rw-r--r--vendor/phar-io/manifest/src/values/BundledComponent.php33
-rw-r--r--vendor/phar-io/manifest/src/values/BundledComponentCollection.php34
-rw-r--r--vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php42
-rw-r--r--vendor/phar-io/manifest/src/values/CopyrightInformation.php31
-rw-r--r--vendor/phar-io/manifest/src/values/Email.php31
-rw-r--r--vendor/phar-io/manifest/src/values/Extension.php46
-rw-r--r--vendor/phar-io/manifest/src/values/Library.php16
-rw-r--r--vendor/phar-io/manifest/src/values/License.php31
-rw-r--r--vendor/phar-io/manifest/src/values/Manifest.php92
-rw-r--r--vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php23
-rw-r--r--vendor/phar-io/manifest/src/values/PhpVersionRequirement.php25
-rw-r--r--vendor/phar-io/manifest/src/values/Requirement.php13
-rw-r--r--vendor/phar-io/manifest/src/values/RequirementCollection.php34
-rw-r--r--vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php42
-rw-r--r--vendor/phar-io/manifest/src/values/Type.php41
-rw-r--r--vendor/phar-io/manifest/src/values/Url.php36
21 files changed, 738 insertions, 0 deletions
diff --git a/vendor/phar-io/manifest/src/values/Application.php b/vendor/phar-io/manifest/src/values/Application.php
new file mode 100644
index 000000000..5420bcb8f
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/Application.php
@@ -0,0 +1,16 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class Application extends Type {
+ public function isApplication(): bool {
+ return true;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/ApplicationName.php b/vendor/phar-io/manifest/src/values/ApplicationName.php
new file mode 100644
index 000000000..d71744ab6
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/ApplicationName.php
@@ -0,0 +1,37 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class ApplicationName {
+ /** @var string */
+ private $name;
+
+ public function __construct(string $name) {
+ $this->ensureValidFormat($name);
+ $this->name = $name;
+ }
+
+ public function asString(): string {
+ return $this->name;
+ }
+
+ public function isEqual(ApplicationName $name): bool {
+ return $this->name === $name->name;
+ }
+
+ private function ensureValidFormat(string $name): void {
+ if (!\preg_match('#\w/\w#', $name)) {
+ throw new InvalidApplicationNameException(
+ \sprintf('Format of name "%s" is not valid - expected: vendor/packagename', $name),
+ InvalidApplicationNameException::InvalidFormat
+ );
+ }
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/Author.php b/vendor/phar-io/manifest/src/values/Author.php
new file mode 100644
index 000000000..82b666e7d
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/Author.php
@@ -0,0 +1,39 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class Author {
+ /** @var string */
+ private $name;
+
+ /** @var Email */
+ private $email;
+
+ public function __construct(string $name, Email $email) {
+ $this->name = $name;
+ $this->email = $email;
+ }
+
+ public function asString(): string {
+ return \sprintf(
+ '%s <%s>',
+ $this->name,
+ $this->email->asString()
+ );
+ }
+
+ public function getName(): string {
+ return $this->name;
+ }
+
+ public function getEmail(): Email {
+ return $this->email;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/AuthorCollection.php b/vendor/phar-io/manifest/src/values/AuthorCollection.php
new file mode 100644
index 000000000..27e50ad84
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/AuthorCollection.php
@@ -0,0 +1,34 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class AuthorCollection implements \Countable, \IteratorAggregate {
+ /** @var Author[] */
+ private $authors = [];
+
+ public function add(Author $author): void {
+ $this->authors[] = $author;
+ }
+
+ /**
+ * @return Author[]
+ */
+ public function getAuthors(): array {
+ return $this->authors;
+ }
+
+ public function count(): int {
+ return \count($this->authors);
+ }
+
+ public function getIterator(): AuthorCollectionIterator {
+ return new AuthorCollectionIterator($this);
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php b/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php
new file mode 100644
index 000000000..4ff3c3943
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php
@@ -0,0 +1,42 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class AuthorCollectionIterator implements \Iterator {
+ /** @var Author[] */
+ private $authors;
+
+ /** @var int */
+ private $position = 0;
+
+ public function __construct(AuthorCollection $authors) {
+ $this->authors = $authors->getAuthors();
+ }
+
+ public function rewind(): void {
+ $this->position = 0;
+ }
+
+ public function valid(): bool {
+ return $this->position < \count($this->authors);
+ }
+
+ public function key(): int {
+ return $this->position;
+ }
+
+ public function current(): Author {
+ return $this->authors[$this->position];
+ }
+
+ public function next(): void {
+ $this->position++;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/BundledComponent.php b/vendor/phar-io/manifest/src/values/BundledComponent.php
new file mode 100644
index 000000000..ea77b4402
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/BundledComponent.php
@@ -0,0 +1,33 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+use PharIo\Version\Version;
+
+class BundledComponent {
+ /** @var string */
+ private $name;
+
+ /** @var Version */
+ private $version;
+
+ public function __construct(string $name, Version $version) {
+ $this->name = $name;
+ $this->version = $version;
+ }
+
+ public function getName(): string {
+ return $this->name;
+ }
+
+ public function getVersion(): Version {
+ return $this->version;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/BundledComponentCollection.php b/vendor/phar-io/manifest/src/values/BundledComponentCollection.php
new file mode 100644
index 000000000..b628eaa35
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/BundledComponentCollection.php
@@ -0,0 +1,34 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class BundledComponentCollection implements \Countable, \IteratorAggregate {
+ /** @var BundledComponent[] */
+ private $bundledComponents = [];
+
+ public function add(BundledComponent $bundledComponent): void {
+ $this->bundledComponents[] = $bundledComponent;
+ }
+
+ /**
+ * @return BundledComponent[]
+ */
+ public function getBundledComponents(): array {
+ return $this->bundledComponents;
+ }
+
+ public function count(): int {
+ return \count($this->bundledComponents);
+ }
+
+ public function getIterator(): BundledComponentCollectionIterator {
+ return new BundledComponentCollectionIterator($this);
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php b/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php
new file mode 100644
index 000000000..462db45a1
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php
@@ -0,0 +1,42 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class BundledComponentCollectionIterator implements \Iterator {
+ /** @var BundledComponent[] */
+ private $bundledComponents;
+
+ /** @var int */
+ private $position = 0;
+
+ public function __construct(BundledComponentCollection $bundledComponents) {
+ $this->bundledComponents = $bundledComponents->getBundledComponents();
+ }
+
+ public function rewind(): void {
+ $this->position = 0;
+ }
+
+ public function valid(): bool {
+ return $this->position < \count($this->bundledComponents);
+ }
+
+ public function key(): int {
+ return $this->position;
+ }
+
+ public function current(): BundledComponent {
+ return $this->bundledComponents[$this->position];
+ }
+
+ public function next(): void {
+ $this->position++;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/CopyrightInformation.php b/vendor/phar-io/manifest/src/values/CopyrightInformation.php
new file mode 100644
index 000000000..d26f94721
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/CopyrightInformation.php
@@ -0,0 +1,31 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class CopyrightInformation {
+ /** @var AuthorCollection */
+ private $authors;
+
+ /** @var License */
+ private $license;
+
+ public function __construct(AuthorCollection $authors, License $license) {
+ $this->authors = $authors;
+ $this->license = $license;
+ }
+
+ public function getAuthors(): AuthorCollection {
+ return $this->authors;
+ }
+
+ public function getLicense(): License {
+ return $this->license;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/Email.php b/vendor/phar-io/manifest/src/values/Email.php
new file mode 100644
index 000000000..588348d89
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/Email.php
@@ -0,0 +1,31 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class Email {
+ /** @var string */
+ private $email;
+
+ public function __construct(string $email) {
+ $this->ensureEmailIsValid($email);
+
+ $this->email = $email;
+ }
+
+ public function asString(): string {
+ return $this->email;
+ }
+
+ private function ensureEmailIsValid(string $url): void {
+ if (\filter_var($url, \FILTER_VALIDATE_EMAIL) === false) {
+ throw new InvalidEmailException;
+ }
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/Extension.php b/vendor/phar-io/manifest/src/values/Extension.php
new file mode 100644
index 000000000..4c5726f8a
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/Extension.php
@@ -0,0 +1,46 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+use PharIo\Version\Version;
+use PharIo\Version\VersionConstraint;
+
+class Extension extends Type {
+ /** @var ApplicationName */
+ private $application;
+
+ /** @var VersionConstraint */
+ private $versionConstraint;
+
+ public function __construct(ApplicationName $application, VersionConstraint $versionConstraint) {
+ $this->application = $application;
+ $this->versionConstraint = $versionConstraint;
+ }
+
+ public function getApplicationName(): ApplicationName {
+ return $this->application;
+ }
+
+ public function getVersionConstraint(): VersionConstraint {
+ return $this->versionConstraint;
+ }
+
+ public function isExtension(): bool {
+ return true;
+ }
+
+ public function isExtensionFor(ApplicationName $name): bool {
+ return $this->application->isEqual($name);
+ }
+
+ public function isCompatibleWith(ApplicationName $name, Version $version): bool {
+ return $this->isExtensionFor($name) && $this->versionConstraint->complies($version);
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/Library.php b/vendor/phar-io/manifest/src/values/Library.php
new file mode 100644
index 000000000..21849e137
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/Library.php
@@ -0,0 +1,16 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class Library extends Type {
+ public function isLibrary(): bool {
+ return true;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/License.php b/vendor/phar-io/manifest/src/values/License.php
new file mode 100644
index 000000000..39542fe87
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/License.php
@@ -0,0 +1,31 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class License {
+ /** @var string */
+ private $name;
+
+ /** @var Url */
+ private $url;
+
+ public function __construct(string $name, Url $url) {
+ $this->name = $name;
+ $this->url = $url;
+ }
+
+ public function getName(): string {
+ return $this->name;
+ }
+
+ public function getUrl(): Url {
+ return $this->url;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/Manifest.php b/vendor/phar-io/manifest/src/values/Manifest.php
new file mode 100644
index 000000000..0140b842b
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/Manifest.php
@@ -0,0 +1,92 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+use PharIo\Version\Version;
+
+class Manifest {
+ /** @var ApplicationName */
+ private $name;
+
+ /** @var Version */
+ private $version;
+
+ /** @var Type */
+ private $type;
+
+ /** @var CopyrightInformation */
+ private $copyrightInformation;
+
+ /** @var RequirementCollection */
+ private $requirements;
+
+ /** @var BundledComponentCollection */
+ private $bundledComponents;
+
+ public function __construct(ApplicationName $name, Version $version, Type $type, CopyrightInformation $copyrightInformation, RequirementCollection $requirements, BundledComponentCollection $bundledComponents) {
+ $this->name = $name;
+ $this->version = $version;
+ $this->type = $type;
+ $this->copyrightInformation = $copyrightInformation;
+ $this->requirements = $requirements;
+ $this->bundledComponents = $bundledComponents;
+ }
+
+ public function getName(): ApplicationName {
+ return $this->name;
+ }
+
+ public function getVersion(): Version {
+ return $this->version;
+ }
+
+ public function getType(): Type {
+ return $this->type;
+ }
+
+ public function getCopyrightInformation(): CopyrightInformation {
+ return $this->copyrightInformation;
+ }
+
+ public function getRequirements(): RequirementCollection {
+ return $this->requirements;
+ }
+
+ public function getBundledComponents(): BundledComponentCollection {
+ return $this->bundledComponents;
+ }
+
+ public function isApplication(): bool {
+ return $this->type->isApplication();
+ }
+
+ public function isLibrary(): bool {
+ return $this->type->isLibrary();
+ }
+
+ public function isExtension(): bool {
+ return $this->type->isExtension();
+ }
+
+ public function isExtensionFor(ApplicationName $application, Version $version = null): bool {
+ if (!$this->isExtension()) {
+ return false;
+ }
+
+ /** @var Extension $type */
+ $type = $this->type;
+
+ if ($version !== null) {
+ return $type->isCompatibleWith($application, $version);
+ }
+
+ return $type->isExtensionFor($application);
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php b/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php
new file mode 100644
index 000000000..088f38584
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php
@@ -0,0 +1,23 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class PhpExtensionRequirement implements Requirement {
+ /** @var string */
+ private $extension;
+
+ public function __construct(string $extension) {
+ $this->extension = $extension;
+ }
+
+ public function asString(): string {
+ return $this->extension;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php b/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php
new file mode 100644
index 000000000..f8d6f6d13
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php
@@ -0,0 +1,25 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+use PharIo\Version\VersionConstraint;
+
+class PhpVersionRequirement implements Requirement {
+ /** @var VersionConstraint */
+ private $versionConstraint;
+
+ public function __construct(VersionConstraint $versionConstraint) {
+ $this->versionConstraint = $versionConstraint;
+ }
+
+ public function getVersionConstraint(): VersionConstraint {
+ return $this->versionConstraint;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/Requirement.php b/vendor/phar-io/manifest/src/values/Requirement.php
new file mode 100644
index 000000000..8b845d6a0
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/Requirement.php
@@ -0,0 +1,13 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+interface Requirement {
+}
diff --git a/vendor/phar-io/manifest/src/values/RequirementCollection.php b/vendor/phar-io/manifest/src/values/RequirementCollection.php
new file mode 100644
index 000000000..b82cd955e
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/RequirementCollection.php
@@ -0,0 +1,34 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class RequirementCollection implements \Countable, \IteratorAggregate {
+ /** @var Requirement[] */
+ private $requirements = [];
+
+ public function add(Requirement $requirement): void {
+ $this->requirements[] = $requirement;
+ }
+
+ /**
+ * @return Requirement[]
+ */
+ public function getRequirements(): array {
+ return $this->requirements;
+ }
+
+ public function count(): int {
+ return \count($this->requirements);
+ }
+
+ public function getIterator(): RequirementCollectionIterator {
+ return new RequirementCollectionIterator($this);
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php b/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php
new file mode 100644
index 000000000..5614eaf7f
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php
@@ -0,0 +1,42 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class RequirementCollectionIterator implements \Iterator {
+ /** @var Requirement[] */
+ private $requirements;
+
+ /** @var int */
+ private $position = 0;
+
+ public function __construct(RequirementCollection $requirements) {
+ $this->requirements = $requirements->getRequirements();
+ }
+
+ public function rewind(): void {
+ $this->position = 0;
+ }
+
+ public function valid(): bool {
+ return $this->position < \count($this->requirements);
+ }
+
+ public function key(): int {
+ return $this->position;
+ }
+
+ public function current(): Requirement {
+ return $this->requirements[$this->position];
+ }
+
+ public function next(): void {
+ $this->position++;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/Type.php b/vendor/phar-io/manifest/src/values/Type.php
new file mode 100644
index 000000000..23b289805
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/Type.php
@@ -0,0 +1,41 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+use PharIo\Version\VersionConstraint;
+
+abstract class Type {
+ public static function application(): Application {
+ return new Application;
+ }
+
+ public static function library(): Library {
+ return new Library;
+ }
+
+ public static function extension(ApplicationName $application, VersionConstraint $versionConstraint): Extension {
+ return new Extension($application, $versionConstraint);
+ }
+
+ /** @psalm-assert-if-true Application $this */
+ public function isApplication(): bool {
+ return false;
+ }
+
+ /** @psalm-assert-if-true Library $this */
+ public function isLibrary(): bool {
+ return false;
+ }
+
+ /** @psalm-assert-if-true Extension $this */
+ public function isExtension(): bool {
+ return false;
+ }
+}
diff --git a/vendor/phar-io/manifest/src/values/Url.php b/vendor/phar-io/manifest/src/values/Url.php
new file mode 100644
index 000000000..639525333
--- /dev/null
+++ b/vendor/phar-io/manifest/src/values/Url.php
@@ -0,0 +1,36 @@
+<?php declare(strict_types = 1);
+/*
+ * This file is part of PharIo\Manifest.
+ *
+ * (c) Arne Blankerts <[email protected]>, Sebastian Heuer <[email protected]>, Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PharIo\Manifest;
+
+class Url {
+ /** @var string */
+ private $url;
+
+ public function __construct(string $url) {
+ $this->ensureUrlIsValid($url);
+
+ $this->url = $url;
+ }
+
+ public function asString(): string {
+ return $this->url;
+ }
+
+ /**
+ * @param string $url
+ *
+ * @throws InvalidUrlException
+ */
+ private function ensureUrlIsValid($url): void {
+ if (\filter_var($url, \FILTER_VALIDATE_URL) === false) {
+ throw new InvalidUrlException;
+ }
+ }
+}