Vendor lock
This commit is contained in:
95
vendor/phar-io/version/src/PreReleaseSuffix.php
vendored
Normal file
95
vendor/phar-io/version/src/PreReleaseSuffix.php
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class PreReleaseSuffix {
|
||||
private $valueScoreMap = [
|
||||
'dev' => 0,
|
||||
'a' => 1,
|
||||
'alpha' => 1,
|
||||
'b' => 2,
|
||||
'beta' => 2,
|
||||
'rc' => 3,
|
||||
'p' => 4,
|
||||
'patch' => 4,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $valueScore;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $number = 0;
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function __construct($value) {
|
||||
$this->parseValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getNumber() {
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PreReleaseSuffix $suffix
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isGreaterThan(PreReleaseSuffix $suffix) {
|
||||
if ($this->valueScore > $suffix->valueScore) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->valueScore < $suffix->valueScore) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->getNumber() > $suffix->getNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function mapValueToScore($value) {
|
||||
if (array_key_exists($value, $this->valueScoreMap)) {
|
||||
return $this->valueScoreMap[$value];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function parseValue($value) {
|
||||
$regex = '/-?(dev|beta|b|rc|alpha|a|patch|p)\.?(\d*).*$/i';
|
||||
if (preg_match($regex, $value, $matches) !== 1) {
|
||||
throw new InvalidPreReleaseSuffixException(sprintf('Invalid label %s', $value));
|
||||
}
|
||||
|
||||
$this->value = $matches[1];
|
||||
if (isset($matches[2])) {
|
||||
$this->number = (int)$matches[2];
|
||||
}
|
||||
$this->valueScore = $this->mapValueToScore($this->value);
|
||||
}
|
||||
}
|
175
vendor/phar-io/version/src/Version.php
vendored
Normal file
175
vendor/phar-io/version/src/Version.php
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class Version {
|
||||
/**
|
||||
* @var VersionNumber
|
||||
*/
|
||||
private $major;
|
||||
|
||||
/**
|
||||
* @var VersionNumber
|
||||
*/
|
||||
private $minor;
|
||||
|
||||
/**
|
||||
* @var VersionNumber
|
||||
*/
|
||||
private $patch;
|
||||
|
||||
/**
|
||||
* @var PreReleaseSuffix
|
||||
*/
|
||||
private $preReleaseSuffix;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $versionString = '';
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
public function __construct($versionString) {
|
||||
$this->ensureVersionStringIsValid($versionString);
|
||||
|
||||
$this->versionString = $versionString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PreReleaseSuffix
|
||||
*/
|
||||
public function getPreReleaseSuffix() {
|
||||
return $this->preReleaseSuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersionString() {
|
||||
return $this->versionString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPreReleaseSuffix() {
|
||||
return $this->preReleaseSuffix !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isGreaterThan(Version $version) {
|
||||
if ($version->getMajor()->getValue() > $this->getMajor()->getValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($version->getMajor()->getValue() < $this->getMajor()->getValue()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($version->getMinor()->getValue() > $this->getMinor()->getValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($version->getMinor()->getValue() < $this->getMinor()->getValue()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($version->getPatch()->getValue() > $this->getPatch()->getValue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($version->getPatch()->getValue() < $this->getPatch()->getValue()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$version->hasPreReleaseSuffix() && $this->hasPreReleaseSuffix()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->getPreReleaseSuffix()->isGreaterThan($version->getPreReleaseSuffix());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return VersionNumber
|
||||
*/
|
||||
public function getMajor() {
|
||||
return $this->major;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return VersionNumber
|
||||
*/
|
||||
public function getMinor() {
|
||||
return $this->minor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return VersionNumber
|
||||
*/
|
||||
public function getPatch() {
|
||||
return $this->patch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $matches
|
||||
*/
|
||||
private function parseVersion(array $matches) {
|
||||
$this->major = new VersionNumber($matches['Major']);
|
||||
$this->minor = new VersionNumber($matches['Minor']);
|
||||
$this->patch = isset($matches['Patch']) ? new VersionNumber($matches['Patch']) : new VersionNumber(null);
|
||||
|
||||
if (isset($matches['PreReleaseSuffix'])) {
|
||||
$this->preReleaseSuffix = new PreReleaseSuffix($matches['PreReleaseSuffix']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $version
|
||||
*
|
||||
* @throws InvalidVersionException
|
||||
*/
|
||||
private function ensureVersionStringIsValid($version) {
|
||||
$regex = '/^v?
|
||||
(?<Major>(0|(?:[1-9][0-9]*)))
|
||||
\\.
|
||||
(?<Minor>(0|(?:[1-9][0-9]*)))
|
||||
(\\.
|
||||
(?<Patch>(0|(?:[1-9][0-9]*)))
|
||||
)?
|
||||
(?:
|
||||
-
|
||||
(?<PreReleaseSuffix>(?:(dev|beta|b|RC|alpha|a|patch|p)\.?\d*))
|
||||
)?
|
||||
$/x';
|
||||
|
||||
if (preg_match($regex, $version, $matches) !== 1) {
|
||||
throw new InvalidVersionException(
|
||||
sprintf("Version string '%s' does not follow SemVer semantics", $version)
|
||||
);
|
||||
}
|
||||
|
||||
$this->parseVersion($matches);
|
||||
}
|
||||
}
|
122
vendor/phar-io/version/src/VersionConstraintParser.php
vendored
Normal file
122
vendor/phar-io/version/src/VersionConstraintParser.php
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class VersionConstraintParser {
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return VersionConstraint
|
||||
*
|
||||
* @throws UnsupportedVersionConstraintException
|
||||
*/
|
||||
public function parse($value) {
|
||||
|
||||
if (strpos($value, '||') !== false) {
|
||||
return $this->handleOrGroup($value);
|
||||
}
|
||||
|
||||
if (!preg_match('/^[\^~\*]?[\d.\*]+(?:-.*)?$/', $value)) {
|
||||
throw new UnsupportedVersionConstraintException(
|
||||
sprintf('Version constraint %s is not supported.', $value)
|
||||
);
|
||||
}
|
||||
|
||||
switch ($value[0]) {
|
||||
case '~':
|
||||
return $this->handleTildeOperator($value);
|
||||
case '^':
|
||||
return $this->handleCaretOperator($value);
|
||||
}
|
||||
|
||||
$version = new VersionConstraintValue($value);
|
||||
|
||||
if ($version->getMajor()->isAny()) {
|
||||
return new AnyVersionConstraint();
|
||||
}
|
||||
|
||||
if ($version->getMinor()->isAny()) {
|
||||
return new SpecificMajorVersionConstraint(
|
||||
$version->getVersionString(),
|
||||
$version->getMajor()->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
if ($version->getPatch()->isAny()) {
|
||||
return new SpecificMajorAndMinorVersionConstraint(
|
||||
$version->getVersionString(),
|
||||
$version->getMajor()->getValue(),
|
||||
$version->getMinor()->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
return new ExactVersionConstraint($version->getVersionString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return OrVersionConstraintGroup
|
||||
*/
|
||||
private function handleOrGroup($value) {
|
||||
$constraints = [];
|
||||
|
||||
foreach (explode('||', $value) as $groupSegment) {
|
||||
$constraints[] = $this->parse(trim($groupSegment));
|
||||
}
|
||||
|
||||
return new OrVersionConstraintGroup($value, $constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AndVersionConstraintGroup
|
||||
*/
|
||||
private function handleTildeOperator($value) {
|
||||
$version = new Version(substr($value, 1));
|
||||
$constraints = [
|
||||
new GreaterThanOrEqualToVersionConstraint($value, $version)
|
||||
];
|
||||
|
||||
if ($version->getPatch()->isAny()) {
|
||||
$constraints[] = new SpecificMajorVersionConstraint(
|
||||
$value,
|
||||
$version->getMajor()->getValue()
|
||||
);
|
||||
} else {
|
||||
$constraints[] = new SpecificMajorAndMinorVersionConstraint(
|
||||
$value,
|
||||
$version->getMajor()->getValue(),
|
||||
$version->getMinor()->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
return new AndVersionConstraintGroup($value, $constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AndVersionConstraintGroup
|
||||
*/
|
||||
private function handleCaretOperator($value) {
|
||||
$version = new Version(substr($value, 1));
|
||||
|
||||
return new AndVersionConstraintGroup(
|
||||
$value,
|
||||
[
|
||||
new GreaterThanOrEqualToVersionConstraint($value, $version),
|
||||
new SpecificMajorVersionConstraint($value, $version->getMajor()->getValue())
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
123
vendor/phar-io/version/src/VersionConstraintValue.php
vendored
Normal file
123
vendor/phar-io/version/src/VersionConstraintValue.php
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class VersionConstraintValue {
|
||||
/**
|
||||
* @var VersionNumber
|
||||
*/
|
||||
private $major;
|
||||
|
||||
/**
|
||||
* @var VersionNumber
|
||||
*/
|
||||
private $minor;
|
||||
|
||||
/**
|
||||
* @var VersionNumber
|
||||
*/
|
||||
private $patch;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $label = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $buildMetaData = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $versionString = '';
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
public function __construct($versionString) {
|
||||
$this->versionString = $versionString;
|
||||
|
||||
$this->parseVersion($versionString);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel() {
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBuildMetaData() {
|
||||
return $this->buildMetaData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersionString() {
|
||||
return $this->versionString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return VersionNumber
|
||||
*/
|
||||
public function getMajor() {
|
||||
return $this->major;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return VersionNumber
|
||||
*/
|
||||
public function getMinor() {
|
||||
return $this->minor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return VersionNumber
|
||||
*/
|
||||
public function getPatch() {
|
||||
return $this->patch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $versionString
|
||||
*/
|
||||
private function parseVersion($versionString) {
|
||||
$this->extractBuildMetaData($versionString);
|
||||
$this->extractLabel($versionString);
|
||||
|
||||
$versionSegments = explode('.', $versionString);
|
||||
$this->major = new VersionNumber($versionSegments[0]);
|
||||
|
||||
$minorValue = isset($versionSegments[1]) ? $versionSegments[1] : null;
|
||||
$patchValue = isset($versionSegments[2]) ? $versionSegments[2] : null;
|
||||
|
||||
$this->minor = new VersionNumber($minorValue);
|
||||
$this->patch = new VersionNumber($patchValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
private function extractBuildMetaData(&$versionString) {
|
||||
if (preg_match('/\+(.*)/', $versionString, $matches) == 1) {
|
||||
$this->buildMetaData = $matches[1];
|
||||
$versionString = str_replace($matches[0], '', $versionString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
private function extractLabel(&$versionString) {
|
||||
if (preg_match('/\-(.*)/', $versionString, $matches) == 1) {
|
||||
$this->label = $matches[1];
|
||||
$versionString = str_replace($matches[0], '', $versionString);
|
||||
}
|
||||
}
|
||||
}
|
41
vendor/phar-io/version/src/VersionNumber.php
vendored
Normal file
41
vendor/phar-io/version/src/VersionNumber.php
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class VersionNumber {
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __construct($value) {
|
||||
if (is_numeric($value)) {
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isAny() {
|
||||
return $this->value === null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
}
|
32
vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php
vendored
Normal file
32
vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
abstract class AbstractVersionConstraint implements VersionConstraint {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $originalValue = '';
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
*/
|
||||
public function __construct($originalValue) {
|
||||
$this->originalValue = $originalValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function asString() {
|
||||
return $this->originalValue;
|
||||
}
|
||||
}
|
43
vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php
vendored
Normal file
43
vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class AndVersionConstraintGroup extends AbstractVersionConstraint {
|
||||
/**
|
||||
* @var VersionConstraint[]
|
||||
*/
|
||||
private $constraints = [];
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param VersionConstraint[] $constraints
|
||||
*/
|
||||
public function __construct($originalValue, array $constraints) {
|
||||
parent::__construct($originalValue);
|
||||
|
||||
$this->constraints = $constraints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function complies(Version $version) {
|
||||
foreach ($this->constraints as $constraint) {
|
||||
if (!$constraint->complies($version)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
29
vendor/phar-io/version/src/constraints/AnyVersionConstraint.php
vendored
Normal file
29
vendor/phar-io/version/src/constraints/AnyVersionConstraint.php
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class AnyVersionConstraint implements VersionConstraint {
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function complies(Version $version) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function asString() {
|
||||
return '*';
|
||||
}
|
||||
}
|
22
vendor/phar-io/version/src/constraints/ExactVersionConstraint.php
vendored
Normal file
22
vendor/phar-io/version/src/constraints/ExactVersionConstraint.php
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class ExactVersionConstraint extends AbstractVersionConstraint {
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function complies(Version $version) {
|
||||
return $this->asString() == $version->getVersionString();
|
||||
}
|
||||
}
|
38
vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php
vendored
Normal file
38
vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint {
|
||||
/**
|
||||
* @var Version
|
||||
*/
|
||||
private $minimalVersion;
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param Version $minimalVersion
|
||||
*/
|
||||
public function __construct($originalValue, Version $minimalVersion) {
|
||||
parent::__construct($originalValue);
|
||||
|
||||
$this->minimalVersion = $minimalVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function complies(Version $version) {
|
||||
return $version->getVersionString() == $this->minimalVersion->getVersionString()
|
||||
|| $version->isGreaterThan($this->minimalVersion);
|
||||
}
|
||||
}
|
43
vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php
vendored
Normal file
43
vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class OrVersionConstraintGroup extends AbstractVersionConstraint {
|
||||
/**
|
||||
* @var VersionConstraint[]
|
||||
*/
|
||||
private $constraints = [];
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param VersionConstraint[] $constraints
|
||||
*/
|
||||
public function __construct($originalValue, array $constraints) {
|
||||
parent::__construct($originalValue);
|
||||
|
||||
$this->constraints = $constraints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function complies(Version $version) {
|
||||
foreach ($this->constraints as $constraint) {
|
||||
if ($constraint->complies($version)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
48
vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php
vendored
Normal file
48
vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint {
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $major = 0;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $minor = 0;
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param int $major
|
||||
* @param int $minor
|
||||
*/
|
||||
public function __construct($originalValue, $major, $minor) {
|
||||
parent::__construct($originalValue);
|
||||
|
||||
$this->major = $major;
|
||||
$this->minor = $minor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function complies(Version $version) {
|
||||
if ($version->getMajor()->getValue() != $this->major) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $version->getMinor()->getValue() == $this->minor;
|
||||
}
|
||||
}
|
37
vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php
vendored
Normal file
37
vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class SpecificMajorVersionConstraint extends AbstractVersionConstraint {
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $major = 0;
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param int $major
|
||||
*/
|
||||
public function __construct($originalValue, $major) {
|
||||
parent::__construct($originalValue);
|
||||
|
||||
$this->major = $major;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function complies(Version $version) {
|
||||
return $version->getMajor()->getValue() == $this->major;
|
||||
}
|
||||
}
|
26
vendor/phar-io/version/src/constraints/VersionConstraint.php
vendored
Normal file
26
vendor/phar-io/version/src/constraints/VersionConstraint.php
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
interface VersionConstraint {
|
||||
/**
|
||||
* @param Version $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function complies(Version $version);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function asString();
|
||||
|
||||
}
|
14
vendor/phar-io/version/src/exceptions/Exception.php
vendored
Normal file
14
vendor/phar-io/version/src/exceptions/Exception.php
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
interface Exception {
|
||||
}
|
7
vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php
vendored
Normal file
7
vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class InvalidPreReleaseSuffixException extends \Exception implements Exception {
|
||||
|
||||
}
|
6
vendor/phar-io/version/src/exceptions/InvalidVersionException.php
vendored
Normal file
6
vendor/phar-io/version/src/exceptions/InvalidVersionException.php
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
class InvalidVersionException extends \InvalidArgumentException implements Exception {
|
||||
}
|
14
vendor/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php
vendored
Normal file
14
vendor/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PharIo\Version.
|
||||
*
|
||||
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace PharIo\Version;
|
||||
|
||||
final class UnsupportedVersionConstraintException extends \RuntimeException implements Exception {
|
||||
}
|
Reference in New Issue
Block a user