Completed
Push — master ( cb2c73...1a2628 )
by Aleh
12s
created

InterfaceNameCompleter::getEntries()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 6
nc 2
nop 2
1
<?php
2
3
namespace Padawan\Domain\Completer;
4
5
use Padawan\Domain\Core\Project;
6
use Padawan\Domain\Core\Completion\Context;
7
use Padawan\Domain\Core\Completion\Entry;
8
9
class InterfaceNameCompleter implements CompleterInterface
10
{
11
    public function getEntries(Project $project, Context $context) {
12
        $entries = [];
13
        foreach ($project->getIndex()->getInterfaces() as $interface) {
14
            $fqcn = $interface->fqcn;
15
            $entries[] = new Entry($fqcn->toString());
16
        }
17
        return $entries;
18
    }
19
20
    public function canHandle(Project $project, Context $context)
21
    {
22
        return $context->isInterfaceName();
23
    }
24
}
25
26