ComponentFactory
2 days ago
Control
2 days ago
Type
2 days ago
AttributeCollection.php
2 days ago
AttributeFactory.php
2 days ago
Children.php
2 days ago
Component.php
2 days ago
ComponentBuilder.php
2 days ago
ComponentCollection.php
2 days ago
ComponentFactory.php
2 days ago
ConditionalComponentFactory.php
2 days ago
ConditionalComponentFactoryCollection.php
2 days ago
Config.php
2 days ago
ConfigCollection.php
2 days ago
ConfigFactory.php
2 days ago
Context.php
2 days ago
Control.php
2 days ago
DefaultSettingsBuilder.php
2 days ago
Encoder.php
2 days ago
Formatter.php
2 days ago
FormatterCollection.php
2 days ago
Control.php
50 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Setting; |
| 6 | |
| 7 | use AC\Expression\NullSpecification; |
| 8 | use AC\Expression\Specification; |
| 9 | use AC\Setting\Control\Input; |
| 10 | |
| 11 | class Control |
| 12 | { |
| 13 | private Input $input; |
| 14 | |
| 15 | private ?Specification $conditions; |
| 16 | |
| 17 | public function __construct( |
| 18 | Input $input, |
| 19 | ?Specification $conditions = null |
| 20 | ) { |
| 21 | $this->input = $input; |
| 22 | $this->conditions = $conditions; |
| 23 | } |
| 24 | |
| 25 | public function get_input(): Input |
| 26 | { |
| 27 | return $this->input; |
| 28 | } |
| 29 | |
| 30 | public function get_name(): string |
| 31 | { |
| 32 | return $this->input->get_name(); |
| 33 | } |
| 34 | |
| 35 | public function has_conditions(): bool |
| 36 | { |
| 37 | return $this->conditions !== null; |
| 38 | } |
| 39 | |
| 40 | public function get_conditions(): Specification |
| 41 | { |
| 42 | if ($this->conditions === null) { |
| 43 | return new NullSpecification(); |
| 44 | } |
| 45 | |
| 46 | return $this->conditions; |
| 47 | } |
| 48 | |
| 49 | } |
| 50 |