1 | <?php |
||
10 | class RestRequestParser |
||
11 | { |
||
12 | /** |
||
13 | * @var MetadataFactory |
||
14 | */ |
||
15 | private $ddrRestMetadataFactory; |
||
16 | |||
17 | 2 | public function __construct(MetadataFactory $ddrRestMetadataFactory) |
|
21 | |||
22 | /** |
||
23 | * @param Request $request |
||
24 | * @param string $entityClass |
||
25 | * @param object|null $entity |
||
26 | * |
||
27 | * @return object |
||
28 | */ |
||
29 | 2 | public function parseEntity( |
|
48 | |||
49 | /** |
||
50 | * @param Request $request |
||
51 | * |
||
52 | * @return array |
||
53 | */ |
||
54 | 2 | protected function getRequestContent(Request $request) |
|
63 | |||
64 | /** |
||
65 | * @param object $object Access by reference. |
||
66 | * @param string $method |
||
67 | * @param array $data |
||
68 | */ |
||
69 | 2 | protected function updateObject( |
|
89 | |||
90 | /** |
||
91 | * @param object $object Access by reference. |
||
92 | * @param string $method |
||
93 | * @param string $propertyName |
||
94 | * @param mixed $value |
||
95 | * @param PropertyMetadata $propertyMetadata |
||
96 | */ |
||
97 | 2 | protected function updateProperty( |
|
124 | |||
125 | // /** |
||
126 | // * @param object $object Access by reference. |
||
127 | // * @param string $method |
||
128 | // * @param string $propertyName |
||
129 | // * @param [] $value |
||
130 | // */ |
||
131 | // protected function updatePropertyObject( |
||
132 | // &$object, |
||
133 | // $method, |
||
134 | // $class, |
||
135 | // $propertyName, |
||
136 | // $value |
||
137 | // ) { |
||
138 | // $propertyObject = $this->propertyAccessor->getValue($object, $propertyName); |
||
139 | // if (null === $propertyObject) { |
||
140 | // $propertyObject = new $class; |
||
141 | // } |
||
142 | // |
||
143 | // $this->updateObject($propertyObject, $method, $value); |
||
144 | // $this->propertyAccessor->setValue($object, $propertyName, $propertyObject); |
||
145 | // } |
||
146 | |||
147 | /** |
||
148 | * @param string $method |
||
149 | * @param PropertyMetadata $propertyMetadata |
||
150 | * |
||
151 | * @return bool |
||
152 | */ |
||
153 | 2 | protected function isUpdateable( |
|
166 | |||
167 | 2 | private function convert(?string $type, $value) |
|
182 | } |
||
183 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.