1 | <?php |
||
12 | class JsonApiParser extends JsonParser |
||
13 | { |
||
14 | /** |
||
15 | * Converts 'type' member to form name |
||
16 | * If not set, type will be converted to singular form. |
||
17 | * For example, 'articles' will be converted to 'Article' |
||
18 | * @var callable |
||
19 | */ |
||
20 | public $formNameCallback = ['tuyakhov\jsonapi\Inflector', 'type2form']; |
||
21 | |||
22 | /** |
||
23 | * Converts member names to variable names |
||
24 | * If not set, all special characters will be replaced by underscore |
||
25 | * For example, 'first-name' will be converted to 'first_name' |
||
26 | * @var callable |
||
27 | */ |
||
28 | public $memberNameCallback = ['tuyakhov\jsonapi\Inflector', 'member2var']; |
||
29 | |||
30 | /** |
||
31 | * Parse resource object into the input data to populates the model |
||
32 | * @inheritdoc |
||
33 | */ |
||
34 | public function parse($rawBody, $contentType) |
||
60 | |||
61 | /** |
||
62 | * @param $type 'type' member of the document |
||
63 | * @return string form name |
||
64 | */ |
||
65 | protected function typeToFormName($type) |
||
69 | |||
70 | /** |
||
71 | * @param array $memberNames |
||
72 | * @return array variable names |
||
73 | */ |
||
74 | protected function parseMemberNames(array $memberNames = []) |
||
78 | |||
79 | /** |
||
80 | * @param $item |
||
81 | * @return array |
||
82 | * @throws BadRequestHttpException |
||
83 | */ |
||
84 | protected function parseResource($item) |
||
103 | |||
104 | /** |
||
105 | * @param array $relObjects |
||
106 | * @return array |
||
107 | */ |
||
108 | protected function parseRelationships(array $relObjects = []) |
||
127 | } |
||
128 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.