Total Complexity | 4 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class BaseConfig extends \yii\base\BaseObject |
||
12 | { |
||
13 | /** @var array supported bootstrap versions */ |
||
14 | protected const VALID_BOOTSTRAP = ['bootstrap4']; |
||
15 | |||
16 | /** @var array valid options of `groupSize` */ |
||
17 | protected const VALID_GROUPSIZES = ['sm', 'md', 'lg']; |
||
18 | |||
19 | /** @var array valid options of `style` */ |
||
20 | protected const VALID_STYLES = ['solid', 'regular', 'light', 'brands']; |
||
21 | |||
22 | /** |
||
23 | * Removes an item from the object and returns the value. If the key does not |
||
24 | * exist in the object, the default value will be returned instead. |
||
25 | * |
||
26 | * @param string $key Key name of the object element |
||
27 | * @param mixed $default The default value to be returned if the specified key does not exist |
||
28 | */ |
||
29 | public function removeValue(string $key, $default = null) |
||
30 | { |
||
31 | if (isset($this->$key)) { |
||
32 | $value = $this->$key; |
||
33 | unset($this->$key); |
||
34 | |||
35 | return $value; |
||
36 | } |
||
37 | |||
38 | return $default; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Checks if validation returned errors and returns the errors. |
||
43 | * |
||
44 | * @param DynamicModel $model Validation model |
||
45 | * |
||
46 | * @return string|null Validation errors |
||
47 | */ |
||
48 | protected function errorSummary(DynamicModel $model): ?string |
||
53 | } |
||
54 | } |
||
55 |