Completed
Pull Request — master (#30)
by
unknown
03:34
created

PhpInterfaceVisitor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 90.91%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
c 2
b 0
f 1
lcom 1
cbo 4
dl 0
loc 21
ccs 10
cts 11
cp 0.9091
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getInterface() 0 3 1
A visitInterface() 0 7 2
1
<?php
2
namespace gossi\codegen\parser\visitor;
3
4
use gossi\codegen\model\PhpInterface;
5
use PhpParser\Node\Stmt\Interface_;
6
7
class PhpInterfaceVisitor extends AbstractPhpStructVisitor {
8
9 1
	public function __construct() {
10 1
		parent::__construct(new PhpInterface());
11 1
	}
12
13
	/**
14
	 * @return PhpInterface
15
	 */
16 1
	public function getInterface() {
17 1
		return $this->struct;
18
	}
19
20 1
	protected function visitInterface(Interface_ $node) {
21 1
		$struct = $this->getInterface();
22
23 1
		foreach ($node->extends as $name) {
24
			$struct->addInterface(implode('\\', $name->parts));
25 1
		}
26 1
	}
27
}
28