| Conditions | 9 |
| Paths | 8 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 9 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 10 | public function getSource($params): IEntriesSource |
|
| 39 | { |
||
| 40 | 10 | if (is_object($params)) { |
|
| 41 | 6 | if ($params instanceof IEntriesSource) { |
|
| 42 | 1 | return $params; |
|
| 43 | } |
||
| 44 | 5 | if ($params instanceof ITree) { |
|
| 45 | 1 | return new Tree($params); |
|
| 46 | } |
||
| 47 | 4 | if ($params instanceof CompositeAdapter) { |
|
| 48 | 1 | return new Files($params); |
|
| 49 | } |
||
| 50 | 3 | if ($params instanceof IStorage) { |
|
| 51 | 3 | return new Storage($params); |
|
| 52 | } |
||
| 53 | 6 | } elseif (is_array($params) && isset($params['source'])) { |
|
| 54 | 3 | return $this->getSource($params['source']); |
|
| 55 | 4 | } elseif (is_string($params)) { |
|
| 56 | 4 | return new Volume($params); |
|
| 57 | } |
||
| 58 | 1 | throw new MenuException($this->getMnLang()->mnNoAvailableEntrySource()); |
|
| 59 | } |
||
| 61 |