| Conditions | 5 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | 14 | public function getStorage($storageParams): ?Interfaces\IStorage |
|
| 32 | { |
||
| 33 | 14 | if (is_object($storageParams) && ($storageParams instanceof Interfaces\IStorage)) { |
|
| 34 | 1 | return $storageParams; |
|
| 35 | } |
||
| 36 | |||
| 37 | 13 | $storage = $this->targetFactory->getStorage($storageParams); |
|
| 38 | 13 | if (empty($storage)) { |
|
| 39 | 1 | return null; |
|
| 40 | } |
||
| 41 | |||
| 42 | 12 | if ($storage instanceof Interfaces\Target\ITargetVolume) { |
|
| 43 | 1 | $publicStorage = new StorageDirs( |
|
| 44 | 1 | $this->keyFactory->getKey($storage), |
|
| 45 | 1 | $storage |
|
| 46 | 1 | ); |
|
| 47 | 1 | $publicStorage->canUse(); |
|
| 48 | 1 | return $publicStorage; |
|
| 49 | |||
| 50 | } else { |
||
| 51 | 12 | $publicStorage = new Storage( |
|
| 52 | 12 | $this->keyFactory->getKey($storage), |
|
| 53 | 12 | $storage |
|
| 54 | 12 | ); |
|
| 55 | 12 | $publicStorage->canUse(); |
|
| 56 | 12 | return $publicStorage; |
|
| 57 | } |
||
| 60 |