SpecificMajorVersionConstraint.php 762 B

12345678910111213141516171819202122232425
  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 SpecificMajorVersionConstraint extends AbstractVersionConstraint {
  12. /** @var int */
  13. private $major;
  14. public function __construct(string $originalValue, int $major) {
  15. parent::__construct($originalValue);
  16. $this->major = $major;
  17. }
  18. public function complies(Version $version): bool {
  19. return $version->getMajor()->getValue() === $this->major;
  20. }
  21. }