GreaterThanOrEqualToVersionConstraint.php 900 B

1234567891011121314151617181920212223242526
  1. <?php declare(strict_types = 1);
  2. /*
  3. * This file is part of PharIo\Version.
  4. *
  5. * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace PharIo\Version;
  11. class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint {
  12. /** @var Version */
  13. private $minimalVersion;
  14. public function __construct(string $originalValue, Version $minimalVersion) {
  15. parent::__construct($originalValue);
  16. $this->minimalVersion = $minimalVersion;
  17. }
  18. public function complies(Version $version): bool {
  19. return $version->getVersionString() === $this->minimalVersion->getVersionString()
  20. || $version->isGreaterThan($this->minimalVersion);
  21. }
  22. }