| Total Complexity | 7 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | final class Feature implements \JsonSerializable |
||
| 10 | { |
||
| 11 | private string $name; |
||
| 12 | |||
| 13 | private bool $enabled; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var \RemotelyLiving\Doorkeeper\Rules\RuleInterface[] |
||
| 17 | */ |
||
| 18 | private $ruleSet = []; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param string $name |
||
| 22 | * @param bool $enabled |
||
| 23 | * @param \RemotelyLiving\Doorkeeper\Rules\RuleInterface[] $rules |
||
| 24 | */ |
||
| 25 | public function __construct(string $name, bool $enabled, array $rules = []) |
||
| 26 | { |
||
| 27 | $this->name = $name; |
||
| 28 | $this->enabled = $enabled; |
||
| 29 | |||
| 30 | foreach ($rules as $rule) { |
||
| 31 | $this->addRule($rule); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | public function getName(): string |
||
| 36 | { |
||
| 37 | return $this->name; |
||
| 38 | } |
||
| 39 | |||
| 40 | public function isEnabled(): bool |
||
| 41 | { |
||
| 42 | return $this->enabled; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @throws \DomainException |
||
| 47 | */ |
||
| 48 | public function addRule(Rules\RuleInterface $rule): void |
||
| 49 | { |
||
| 50 | $this->ruleSet[] = $rule; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return \RemotelyLiving\Doorkeeper\Rules\RuleInterface[] |
||
| 55 | */ |
||
| 56 | public function getRules(): array |
||
| 59 | } |
||
| 60 | |||
| 61 | public function jsonSerialize(): array |
||
| 62 | { |
||
| 67 | ]; |
||
| 68 | } |
||
| 70 |