Total Complexity | 11 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class Attribute |
||
12 | { |
||
13 | private $value; |
||
14 | private $attribute; |
||
15 | |||
16 | /** |
||
17 | * @param string $attribute |
||
18 | * @param mixed $value |
||
19 | */ |
||
20 | public function __construct($attribute, $value = null) |
||
24 | } |
||
25 | |||
26 | public function getName() |
||
27 | { |
||
28 | return $this->attribute; |
||
29 | } |
||
30 | |||
31 | public function getValue() |
||
32 | { |
||
33 | return $this->value; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Indicates whether the attribute can skip validation by the given rule. |
||
38 | * |
||
39 | * @param RuleInterface $rule |
||
40 | * |
||
41 | * @return bool |
||
42 | */ |
||
43 | public function canSkip(RuleInterface $rule) |
||
44 | { |
||
45 | return $rule instanceof Sometimes && $this->isEmpty(); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Indicates whether the attribute is valid according to the given rule. |
||
50 | * |
||
51 | * @param RuleInterface $rule |
||
52 | * |
||
53 | * @return bool |
||
54 | */ |
||
55 | public function conformsTo(RuleInterface $rule) |
||
60 | } |
||
61 | |||
62 | public function isEmpty() |
||
65 | } |
||
66 | } |
||
67 |