Conditions | 4 |
Paths | 8 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4.1967 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | 10 | protected function normalizeResponse($response) |
|
15 | { |
||
16 | 10 | $normalizedPath = ltrim($this->removePathPrefix($response['path_display']), '/'); |
|
|
|||
17 | |||
18 | 10 | $normalizedResponse = ['path' => $normalizedPath]; |
|
19 | |||
20 | 10 | if (isset($response['server_modified'])) { |
|
21 | 8 | $normalizedResponse['timestamp'] = strtotime($response['server_modified']); |
|
22 | 8 | } |
|
23 | |||
24 | 10 | if (isset($response['size'])) { |
|
25 | $normalizedResponse['size'] = $response['size']; |
||
26 | $normalizedResponse['bytes'] = $response['size']; |
||
27 | } |
||
28 | |||
29 | 10 | $type = ($response['.tag'] === 'folder' ? 'dir' : 'file'); |
|
30 | 10 | $normalizedResponse['type'] = $type; |
|
31 | |||
32 | 10 | return $normalizedResponse; |
|
33 | } |
||
34 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.