ConstantParserVisitor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 7
dl 0
loc 20
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A visitConstants() 0 6 2
A visitConstant() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace gossi\codegen\parser\visitor;
5
6
use gossi\codegen\model\PhpConstant;
7
use gossi\codegen\parser\visitor\parts\MemberParserPart;
8
use gossi\codegen\parser\visitor\parts\ValueParserPart;
9
use PhpParser\Comment\Doc;
10
use PhpParser\Node\Const_;
11
use PhpParser\Node\Stmt\ClassConst;
12
13
class ConstantParserVisitor extends StructParserVisitor {
14
15
	use MemberParserPart;
16
	use ValueParserPart;
17
18 3
	public function visitConstants(ClassConst $node) {
19 3
		$doc = $node->getDocComment();
20 3
		foreach ($node->consts as $const) {
21 3
			$this->visitConstant($const, $doc);
22
		}
23 3
	}
24
25 3
	public function visitConstant(Const_ $node, Doc $doc = null) {
26 3
		$const = new PhpConstant($node->name->name);
27 3
		$this->parseValue($const, $node);
28 3
		$this->parseMemberDocblock($const, $doc);
29
30 3
		$this->struct->setConstant($const);
31 3
	}
32
}
33