| Conditions | 7 |
| Paths | 18 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function findSource() : Source |
||
| 39 | { |
||
| 40 | $source_name = NULL; |
||
| 41 | $index = $this; |
||
| 42 | |||
| 43 | do { |
||
| 44 | foreach ($index->iterateOptions() as $option) { |
||
| 45 | if(eIndexOption::SOURCE()->is($option->getName()) ) { |
||
| 46 | $source_name = $option->getValue(); |
||
| 47 | } |
||
| 48 | } |
||
| 49 | if($index->isHasInheritance()) { |
||
| 50 | $index = $index->getInheritance(); |
||
| 51 | } |
||
| 52 | } while($index->isHasInheritance()); |
||
| 53 | |||
| 54 | foreach ($this->getConfiguration()->iterateSource() as $source) { |
||
| 55 | if($source->getName() === $source_name) { |
||
| 56 | return $source; |
||
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | throw new \RuntimeException('Source for index does not found'); |
||
| 61 | } |
||
| 62 | } |