| Total Complexity | 10 | 
| Total Lines | 95 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 12 | class Tab  | 
            ||
| 13 | { | 
            ||
| 14 | /** @var string */  | 
            ||
| 15 | protected $caption;  | 
            ||
| 16 | |||
| 17 | /** @var array ~ [LCI\Blend\Helpers\MIGX\Field, ... ] */  | 
            ||
| 18 | protected $fields = [];  | 
            ||
| 19 | |||
| 20 | /** @var array */  | 
            ||
| 21 | protected $custom_properties = [];  | 
            ||
| 22 | |||
| 23 | /**  | 
            ||
| 24 | * Tab constructor.  | 
            ||
| 25 | * @param string $caption  | 
            ||
| 26 | */  | 
            ||
| 27 | public function __construct(string $caption)  | 
            ||
| 28 |     { | 
            ||
| 29 | $this->caption = $caption;  | 
            ||
| 30 | }  | 
            ||
| 31 | |||
| 32 | /**  | 
            ||
| 33 | * @return string  | 
            ||
| 34 | */  | 
            ||
| 35 | public function getCaption(): string  | 
            ||
| 38 | }  | 
            ||
| 39 | |||
| 40 | /**  | 
            ||
| 41 | * @return array ~ [LCI\Blend\Helpers\MIGX\Field, ... ]  | 
            ||
| 42 | */  | 
            ||
| 43 | public function getFields(): array  | 
            ||
| 44 |     { | 
            ||
| 45 | return $this->fields;  | 
            ||
| 46 | }  | 
            ||
| 47 | |||
| 48 | /**  | 
            ||
| 49 | * @param array $columns ~ any existing columns to pass first  | 
            ||
| 50 | * @return array  | 
            ||
| 51 | */  | 
            ||
| 52 | public function getGridColumns($columns=[])  | 
            ||
| 53 |     { | 
            ||
| 54 | $fields = $this->getFields();  | 
            ||
| 55 | |||
| 56 | /** @var Field $field */  | 
            ||
| 57 |         foreach ($fields as $field) { | 
            ||
| 58 |             if ($field->isShowInGrid()) { | 
            ||
| 59 | $columns[] = $field->getGridArray();  | 
            ||
| 60 | }  | 
            ||
| 61 | }  | 
            ||
| 62 | |||
| 63 | return $columns;  | 
            ||
| 64 | }  | 
            ||
| 65 | /**  | 
            ||
| 66 | * @return array  | 
            ||
| 67 | */  | 
            ||
| 68 | public function toArray()  | 
            ||
| 69 |     { | 
            ||
| 70 | $data = [  | 
            ||
| 71 | 'caption' => $this->caption,  | 
            ||
| 72 | 'fields' => []  | 
            ||
| 73 | ];  | 
            ||
| 74 | |||
| 75 | /** @var Field $field */  | 
            ||
| 76 |         foreach ($this->fields as $field) { | 
            ||
| 77 | $data['fields'][] = $field->toArray();  | 
            ||
| 78 | }  | 
            ||
| 79 | |||
| 80 | return $data;  | 
            ||
| 81 | }  | 
            ||
| 82 | |||
| 83 | /**  | 
            ||
| 84 | * @param string $name  | 
            ||
| 85 | * @return Field  | 
            ||
| 86 | */  | 
            ||
| 87 | public function makeField(string $name)  | 
            ||
| 94 | }  | 
            ||
| 95 | |||
| 96 | /**  | 
            ||
| 97 | * Use if a custom MIGX property is needed that is not defined in this object  | 
            ||
| 98 | * @param string $key  | 
            ||
| 99 | * @param mixed $value  | 
            ||
| 100 | * @return $this  | 
            ||
| 101 | */  | 
            ||
| 102 | public function setCustomProperty($key, $value): self  | 
            ||
| 107 | }  | 
            ||
| 108 | |||
| 109 | |||
| 110 | }  |