Пример #1
0
 public function __construct(string $value)
 {
     if (!(new FragmentSpecification())->isSatisfiedBy(new Url($value))) {
         throw new InvalidArgumentException(sprintf('The value "%s" is not a valid fragment', $value));
     }
     parent::__construct($value);
 }
Пример #2
0
 public function __construct(string $value)
 {
     parent::__construct($value);
     if (!$this->match('/^[a-z]+$/')) {
         throw new InvalidArgumentException(sprintf('The value "%s" is not a valid scheme', $value));
     }
 }
Пример #3
0
 public function __construct(string $value)
 {
     if (!(new AbsolutePath())->isSatisfiedBy(new Url($value))) {
         throw new InvalidArgumentException(sprintf('The value "%s" is not a valid path', $value));
     }
     parent::__construct($value);
 }