| Total Complexity | 6 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 8 | final class Binding |
||
| 9 | { |
||
| 10 | private ?string $name; |
||
| 11 | |||
| 12 | private array $constraints; |
||
| 13 | |||
| 14 | public function __construct(?string $name, array $constraints) |
||
| 15 | { |
||
| 16 | $this->name = $name; |
||
| 17 | $this->constraints = $constraints; |
||
| 18 | } |
||
| 19 | |||
| 20 | public static function named(string $name, array $constraints): Binding |
||
| 21 | { |
||
| 22 | return new static($name, $constraints); |
||
| 23 | } |
||
| 24 | |||
| 25 | public static function unnamed(Constraint $constraint): Binding |
||
| 26 | { |
||
| 27 | return new static(null, [$constraint]); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function isNamed(): bool |
||
| 31 | { |
||
| 32 | return $this->getName() != null; |
||
|
|
|||
| 33 | } |
||
| 34 | |||
| 35 | public function getName(): ?string |
||
| 38 | } |
||
| 39 | |||
| 40 | public function getConstraints(): array |
||
| 43 | } |
||
| 44 | } |
||
| 45 |