Total Complexity | 7 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class FormSettings extends Model |
||
12 | { |
||
13 | public $itemPerApp; |
||
14 | public $minLength; |
||
15 | |||
16 | private $_configs; |
||
17 | |||
18 | /** |
||
19 | * ForumSettings constructor. Construct model with default values |
||
20 | * @param array|null $configs |
||
21 | */ |
||
22 | public function __construct(array $configs = null) |
||
26 | } |
||
27 | |||
28 | public function before() |
||
29 | { |
||
30 | if ($this->_configs === null) { |
||
31 | return; |
||
32 | } |
||
33 | foreach ($this->_configs as $property => $value) { |
||
34 | if (property_exists($this, $property)) { |
||
35 | $this->$property = $value; |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Labels for admin settings form |
||
42 | * @return array |
||
43 | */ |
||
44 | public function labels(): array |
||
45 | { |
||
46 | return [ |
||
47 | 'itemPerApp' => __('Search count'), |
||
48 | 'minLength' => __('Min length') |
||
49 | ]; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Validation rules |
||
54 | * @return @array |
||
|
|||
55 | */ |
||
56 | public function rules(): array |
||
61 | ]; |
||
62 | } |
||
63 | } |
||
64 |