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 |
||
10 | class BaseAttribute implements AttributeInterface |
||
11 | { |
||
12 | public function __construct( |
||
13 | protected string $name, |
||
14 | private $value = null, |
||
15 | private $default = null, |
||
16 | private $rules = [] |
||
17 | ) { |
||
18 | } |
||
19 | |||
20 | public static function provider(): CrudPanel |
||
21 | { |
||
22 | return app('crud'); |
||
23 | } |
||
24 | |||
25 | public static function getValidationRules(): array |
||
26 | { |
||
27 | return []; |
||
28 | } |
||
29 | |||
30 | public static function make(string $name, $value = null, $default = [], $rules = []) |
||
31 | { |
||
32 | return new static($name, $value, $default, $rules); |
||
33 | } |
||
34 | |||
35 | public static function getDefault(AttributeCollection $attributes) |
||
36 | { |
||
37 | return null; |
||
38 | } |
||
39 | |||
40 | public static function getAttributeName(): string |
||
41 | { |
||
42 | return static::$name; |
||
43 | } |
||
44 | |||
45 | public function setValue($value) |
||
46 | { |
||
47 | $this->validate($value); |
||
48 | |||
49 | $this->value = $value; |
||
50 | |||
51 | return $this; |
||
52 | } |
||
53 | |||
54 | public function setRules(array $rules) |
||
55 | { |
||
56 | $this->rules = $rules; |
||
57 | } |
||
58 | |||
59 | public function rules(): array |
||
62 | } |
||
63 | |||
64 | public function value() |
||
65 | { |
||
66 | return $this->value; |
||
67 | } |
||
68 | |||
69 | private function validate($value) |
||
75 | } |
||
76 | } |
||
77 | } |
||
78 |