| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | 9 | public function handle($path, array $metadata) |
|
| 30 | { |
||
| 31 | 9 | $object = $this->filesystem->getMetadata($path); |
|
| 32 | |||
| 33 | 9 | if ( ! $object) { |
|
| 34 | 3 | return false; |
|
| 35 | } |
||
| 36 | |||
| 37 | 6 | $keys = array_diff($metadata, array_keys($object)); |
|
| 38 | |||
| 39 | 6 | foreach ($keys as $key) { |
|
| 40 | 6 | if ( ! method_exists($this->filesystem, $method = 'get' . ucfirst($key))) { |
|
| 41 | 3 | throw new InvalidArgumentException('Could not fetch metadata: ' . $key); |
|
| 42 | } |
||
| 43 | |||
| 44 | 3 | $object[$key] = $this->filesystem->{$method}($path); |
|
| 45 | 3 | } |
|
| 46 | |||
| 47 | 3 | return $object; |
|
| 48 | } |
||
| 49 | } |
||
| 50 |