We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Total Complexity | 12 |
Total Lines | 65 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class BaseAttribute implements SmartAttributeInterface |
||
10 | { |
||
11 | public function __construct( |
||
12 | protected string $name, |
||
13 | private $value = null, |
||
14 | private $rules = [], |
||
15 | private $default = [] |
||
16 | ) { |
||
17 | } |
||
18 | |||
19 | public static function getValidationRules(SmartCollectionInterface $attributes): array |
||
20 | { |
||
21 | return []; |
||
22 | } |
||
23 | |||
24 | public static function make(string $name, $value = null, $rules = []) |
||
25 | { |
||
26 | return new static($name, $value, $rules); |
||
27 | } |
||
28 | |||
29 | public static function getDefault(SmartCollectionInterface $attributes) |
||
30 | { |
||
31 | return null; |
||
32 | } |
||
33 | |||
34 | public static function getAttributeName(): string |
||
35 | { |
||
36 | return self::$name; |
||
37 | } |
||
38 | |||
39 | public function setValue($value) |
||
40 | { |
||
41 | $this->validate($value); |
||
42 | |||
43 | $this->value = $value; |
||
44 | |||
45 | return $this; |
||
46 | } |
||
47 | |||
48 | public function setRules(array $rules) |
||
49 | { |
||
50 | $this->rules = $rules; |
||
51 | } |
||
52 | |||
53 | public function rules(): array |
||
56 | } |
||
57 | |||
58 | public function value() |
||
59 | { |
||
60 | return $this->value; |
||
61 | } |
||
62 | |||
63 | public function name(): string |
||
66 | } |
||
67 | |||
68 | private function validate($value) |
||
69 | { |
||
74 | } |
||
75 | } |
||
77 |