| Total Complexity | 11 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class FormField extends AbstractField |
||
| 14 | { |
||
| 15 | public const ACTION_CREATE = 'create'; |
||
| 16 | public const ACTION_EDIT = 'edit'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | public $action; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var array |
||
| 25 | */ |
||
| 26 | public $options = []; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var integer |
||
| 30 | */ |
||
| 31 | public $position; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var string |
||
| 35 | */ |
||
| 36 | public $group; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var string |
||
| 40 | */ |
||
| 41 | public $tab; |
||
| 42 | |||
| 43 | public function getSettings(): array |
||
| 44 | { |
||
| 45 | return [ |
||
| 46 | $this->type, |
||
| 47 | $this->options, |
||
| 48 | $this->fieldDescriptionOptions |
||
| 49 | ]; |
||
| 50 | } |
||
| 51 | |||
| 52 | public function hasGroup(): bool |
||
| 53 | { |
||
| 54 | return $this->group !== null; |
||
| 55 | } |
||
| 56 | |||
| 57 | public function hasTab(): bool |
||
| 60 | } |
||
| 61 | |||
| 62 | public function getGroup(): ?string |
||
| 63 | { |
||
| 64 | if ($this->tab && $this->group) { |
||
| 65 | throw new \InvalidArgumentException('You can set either group or tab, not both.'); |
||
| 66 | } |
||
| 67 | |||
| 68 | return $this->group !== "" ? $this->group : null; |
||
| 69 | } |
||
| 70 | |||
| 71 | public function getTab(): ?string |
||
| 78 | } |
||
| 79 | } |
||
| 80 |