1 | <?php |
||
32 | trait ValidatorTrait |
||
33 | { |
||
34 | /** |
||
35 | * Filter Csv control character |
||
36 | * |
||
37 | * @param string $char Csv control character |
||
38 | * @param string $type Csv control character type |
||
39 | * @param string $method Method call |
||
40 | * |
||
41 | * @throws InvalidArgumentException If the Csv control character is not one character only. |
||
42 | * |
||
43 | * @return string |
||
44 | */ |
||
45 | 52 | protected function filterControl(string $char, string $type, string $method) |
|
53 | |||
54 | /** |
||
55 | * Validate an integer |
||
56 | * |
||
57 | * @param int $value |
||
58 | * @param int $min_value |
||
59 | * @param string $error_message |
||
60 | * |
||
61 | * @throws InvalidArgumentException If the value is invalid |
||
62 | * |
||
63 | * @return int |
||
64 | */ |
||
65 | 94 | protected function filterInteger(int $value, int $min_value, string $error_message): int |
|
73 | |||
74 | /** |
||
75 | * Validates the array to be used by the fetchAssoc method |
||
76 | * |
||
77 | * @param array $keys |
||
78 | * |
||
79 | * @throws InvalidArgumentException If the submitted array fails the assertion |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | 44 | protected function filterColumnNames(array $keys): array |
|
91 | |||
92 | /** |
||
93 | * Validate the argument given is an iterable |
||
94 | * |
||
95 | * @param array|Traversable $iterable |
||
96 | * @param string $method |
||
97 | * |
||
98 | * @throws InvalidArgumentException If the submitted value is not iterable |
||
99 | * |
||
100 | * @return array|Traversable |
||
101 | */ |
||
102 | 14 | protected function filterIterable($iterable, string $method) |
|
110 | |||
111 | /** |
||
112 | * Filter XML element name |
||
113 | * |
||
114 | * @param string $value Element name |
||
115 | * |
||
116 | * @throws DOMException If the Element name is invalid |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | 6 | protected function filterNodeName(string $value): string |
|
126 | |||
127 | /** |
||
128 | * Filter XML attribute name |
||
129 | * |
||
130 | * @param string $value Element name |
||
131 | * |
||
132 | * @throws DOMException If the Element attribute name is invalid |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | 4 | protected function filterAttributeName(string $value): string |
|
146 | } |
||
147 |