| Conditions | 5 |
| Paths | 6 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function map(Request $request, array $propsMap): array |
||
| 14 | { |
||
| 15 | if (!array_key_exists('path', $propsMap)) { |
||
| 16 | return []; |
||
| 17 | } |
||
| 18 | |||
| 19 | $pathProps = (array)$propsMap['path']; |
||
| 20 | $result = []; |
||
| 21 | foreach ($pathProps as $paramName => $paramValue) { |
||
| 22 | if ($required = $this->isParamRequired($paramName)) { |
||
|
|
|||
| 23 | $paramName = substr($paramName, 1); |
||
| 24 | $this->assertRequiredParamIsPresent($paramName, $request); |
||
| 25 | } |
||
| 26 | |||
| 27 | if (!$request->attributes->has($paramName)) { |
||
| 28 | continue; |
||
| 29 | } |
||
| 30 | |||
| 31 | $finalPropName = $paramValue ?? $paramName; |
||
| 32 | $result[$finalPropName] = $request->attributes->get($paramName); |
||
| 33 | } |
||
| 34 | |||
| 35 | return $result; |
||
| 36 | } |
||
| 37 | |||
| 54 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.