1 | <?php |
||
20 | class DataAttributesHelper |
||
21 | { |
||
22 | /** |
||
23 | * @link http://jsonapi.org/format/#document-member-names-reserved-characters |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected static $forbiddenMemberNameCharacters = [ |
||
28 | '+', |
||
29 | ',', |
||
30 | '.', |
||
31 | '[', |
||
32 | ']', |
||
33 | '!', |
||
34 | '"', |
||
35 | '#', |
||
36 | '$', |
||
37 | '%', |
||
38 | '&', |
||
39 | '\'', |
||
40 | '(', |
||
41 | ')', |
||
42 | '*', |
||
43 | '/', |
||
44 | ':', |
||
45 | ';', |
||
46 | '<', |
||
47 | '=', |
||
48 | '>', |
||
49 | '?', |
||
50 | '@', |
||
51 | '\\', |
||
52 | '^', |
||
53 | '`', |
||
54 | '{', |
||
55 | '|', |
||
56 | '}', |
||
57 | '~', |
||
58 | ]; |
||
59 | |||
60 | /** |
||
61 | * @link http://jsonapi.org/format/#document-member-names-allowed-characters |
||
62 | * |
||
63 | * @var array |
||
64 | */ |
||
65 | protected static $forbiddenAsFirstOrLastCharacter = [ |
||
66 | '-', |
||
67 | '_', |
||
68 | ' ', |
||
69 | ]; |
||
70 | |||
71 | /** |
||
72 | * Changes all array keys to under_score format using recursion. |
||
73 | * |
||
74 | * @param array $array |
||
75 | */ |
||
76 | protected static function recursiveSetKeysToUnderScore(array &$array) |
||
89 | |||
90 | /** |
||
91 | * @param \NilPortugues\Api\Mapping\Mapping[] $mappings |
||
92 | * @param array $array |
||
93 | * |
||
94 | * @return array |
||
95 | */ |
||
96 | public static function setResponseDataAttributes(array &$mappings, array &$array) |
||
130 | |||
131 | /** |
||
132 | * @param string $attributeName |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | public static function transformToValidMemberName($attributeName) |
||
145 | |||
146 | /** |
||
147 | * @param mixed $value |
||
148 | * |
||
149 | * @return bool |
||
150 | */ |
||
151 | protected static function isScalarValue($value) |
||
157 | |||
158 | /** |
||
159 | * @param array $input |
||
160 | * @param bool $foundIdentifierKey |
||
161 | * |
||
162 | * @return bool |
||
163 | */ |
||
164 | protected static function containsClassIdentifierKey(array $input, $foundIdentifierKey = false) |
||
189 | } |
||
190 |