Added Laravel project
This commit is contained in:
32
Laravel/vendor/phar-io/version/src/AbstractVersionConstraint.php
vendored
Normal file
32
Laravel/vendor/phar-io/version/src/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
Laravel/vendor/phar-io/version/src/AndVersionConstraintGroup.php
vendored
Normal file
43
Laravel/vendor/phar-io/version/src/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
Laravel/vendor/phar-io/version/src/AnyVersionConstraint.php
vendored
Normal file
29
Laravel/vendor/phar-io/version/src/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
Laravel/vendor/phar-io/version/src/ExactVersionConstraint.php
vendored
Normal file
22
Laravel/vendor/phar-io/version/src/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();
|
||||
}
|
||||
}
|
14
Laravel/vendor/phar-io/version/src/Exception.php
vendored
Normal file
14
Laravel/vendor/phar-io/version/src/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 {
|
||||
}
|
38
Laravel/vendor/phar-io/version/src/GreaterThanOrEqualToVersionConstraint.php
vendored
Normal file
38
Laravel/vendor/phar-io/version/src/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);
|
||||
}
|
||||
}
|
5
Laravel/vendor/phar-io/version/src/InvalidVersionException.php
vendored
Normal file
5
Laravel/vendor/phar-io/version/src/InvalidVersionException.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
namespace PharIo\Version;
|
||||
|
||||
class InvalidVersionException extends \InvalidArgumentException implements Exception {
|
||||
}
|
43
Laravel/vendor/phar-io/version/src/OrVersionConstraintGroup.php
vendored
Normal file
43
Laravel/vendor/phar-io/version/src/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;
|
||||
}
|
||||
}
|
41
Laravel/vendor/phar-io/version/src/PreReleaseSuffix.php
vendored
Normal file
41
Laravel/vendor/phar-io/version/src/PreReleaseSuffix.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace PharIo\Version;
|
||||
|
||||
class PreReleaseSuffix
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $number;
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @param int|null $number
|
||||
*/
|
||||
public function __construct($value, $number = null)
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->number = $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getNumber()
|
||||
{
|
||||
return $this->number;
|
||||
}
|
||||
}
|
48
Laravel/vendor/phar-io/version/src/SpecificMajorAndMinorVersionConstraint.php
vendored
Normal file
48
Laravel/vendor/phar-io/version/src/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
Laravel/vendor/phar-io/version/src/SpecificMajorVersionConstraint.php
vendored
Normal file
37
Laravel/vendor/phar-io/version/src/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;
|
||||
}
|
||||
}
|
14
Laravel/vendor/phar-io/version/src/UnsupportedVersionConstraintException.php
vendored
Normal file
14
Laravel/vendor/phar-io/version/src/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 {
|
||||
}
|
162
Laravel/vendor/phar-io/version/src/Version.php
vendored
Normal file
162
Laravel/vendor/phar-io/version/src/Version.php
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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['ReleaseType'])) {
|
||||
$preReleaseNumber = isset($matches['ReleaseTypeCount']) ? (int) $matches['ReleaseTypeCount'] : null;
|
||||
|
||||
$this->preReleaseSuffix = new PreReleaseSuffix($matches['ReleaseType'], $preReleaseNumber);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PreReleaseSuffix
|
||||
*/
|
||||
public function getPreReleaseSuffix()
|
||||
{
|
||||
return $this->preReleaseSuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersionString() {
|
||||
return $this->versionString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 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]*)))
|
||||
)?
|
||||
(?:
|
||||
-
|
||||
(?<ReleaseType>(?:(dev|beta|b|RC|alpha|a|patch|p)))
|
||||
(?:
|
||||
(?<ReleaseTypeCount>[0-9])
|
||||
)?
|
||||
)?
|
||||
$/x';
|
||||
|
||||
if (preg_match($regex, $version, $matches) !== 1) {
|
||||
throw new InvalidVersionException(
|
||||
sprintf("Version string '%s' does not follow SemVer semantics", $version)
|
||||
);
|
||||
}
|
||||
|
||||
$this->parseVersion($matches);
|
||||
}
|
||||
}
|
26
Laravel/vendor/phar-io/version/src/VersionConstraint.php
vendored
Normal file
26
Laravel/vendor/phar-io/version/src/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();
|
||||
|
||||
}
|
122
Laravel/vendor/phar-io/version/src/VersionConstraintParser.php
vendored
Normal file
122
Laravel/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(
|
||||
$value,
|
||||
$version->getMajor()->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
if ($version->getPatch()->isAny()) {
|
||||
return new SpecificMajorAndMinorVersionConstraint(
|
||||
$value,
|
||||
$version->getMajor()->getValue(),
|
||||
$version->getMinor()->getValue()
|
||||
);
|
||||
}
|
||||
|
||||
return new ExactVersionConstraint($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
Laravel/vendor/phar-io/version/src/VersionConstraintValue.php
vendored
Normal file
123
Laravel/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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
41
Laravel/vendor/phar-io/version/src/VersionNumber.php
vendored
Normal file
41
Laravel/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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user