| Conditions | 5 |
| Paths | 16 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 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 | 10 | $normalizedResponse['timestamp'] = isset($response['server_modified']) ? |
|
| 20 | 10 | strtotime($response['server_modified']) : ''; |
|
| 21 | 10 | $normalizedResponse['size'] = isset($response['size']) ? $response['size'] : 0; |
|
| 22 | 10 | $normalizedResponse['bytes'] = isset($response['size']) ? $response['size'] : 0; |
|
| 23 | |||
| 24 | 10 | $type = ($response['.tag'] === 'folder' ? 'dir' : 'file'); |
|
| 25 | 10 | $normalizedResponse['type'] = $type; |
|
| 26 | |||
| 27 | 10 | return $normalizedResponse; |
|
| 28 | } |
||
| 29 | } |
||
| 30 |
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
Idableprovides a methodequalsIdthat 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.