| Conditions | 5 |
| Paths | 3 |
| Total Lines | 29 |
| Code Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public function getEntries(Project $project, Context $context) |
||
| 12 | { |
||
| 13 | $entries = []; |
||
| 14 | $postfix = trim($context->getData()); |
||
| 15 | $index = $project->getIndex(); |
||
| 16 | $fqcns = array_merge($index->getClasses(), $index->getInterfaces()); |
||
| 17 | foreach ($fqcns as $fqcn => $class) { |
||
| 18 | if (!empty($postfix) && strpos($fqcn, $postfix) === false) { |
||
| 19 | continue; |
||
| 20 | } |
||
| 21 | $complete = str_replace($postfix, "", $fqcn); |
||
| 22 | $entries[] = new Entry( |
||
| 23 | $complete, |
||
| 24 | '', |
||
| 25 | '', |
||
| 26 | $fqcn |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | usort($entries, function($a, $b) { |
||
| 30 | $aname = $a->getName(); |
||
| 31 | $bname = $b->getName(); |
||
| 32 | $strlenDiff = strlen($aname) - strlen($bname); |
||
| 33 | if ($strlenDiff === 0) { |
||
| 34 | return $aname > $bname; |
||
| 35 | } |
||
| 36 | return $strlenDiff; |
||
| 37 | }); |
||
| 38 | return $entries; |
||
| 39 | } |
||
| 40 | |||
| 46 |