Unit   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 35
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getType() 0 5 2
1
<?php
2
namespace gossi\formatter\entities;
3
4
use phootwork\tokenizer\Token;
5
6
class Unit {
7
8
	const UNIT_NAMESPACE = 'namespace';
9
	const UNIT_USE = 'use';
10
	const UNIT_TRAITS = 'traits';
11
	const UNIT_FIELDS = 'fields';
12
	const UNIT_CONSTANTS = 'constants';
13
	const UNIT_METHODS = 'methods';
14
	const UNIT_IMPORTS = 'imports';
15
16
	private static $typeMap = [
17
		T_NAMESPACE => self::UNIT_NAMESPACE,
18
		T_USE => self::UNIT_USE,
19
		T_CONST => self::UNIT_CONSTANTS,
20
		T_NAMESPACE => self::UNIT_NAMESPACE,
21
		T_USE => self::UNIT_USE,
22
		T_REQUIRE => self::UNIT_IMPORTS,
23
		T_REQUIRE_ONCE => self::UNIT_IMPORTS,
24
		T_INCLUDE => self::UNIT_IMPORTS,
25
		T_INCLUDE_ONCE => self::UNIT_IMPORTS
26
	];
27
28
	/** @var Token */
29
	public $start = null;
30
31
	/** @var Token */
32
	public $end = null;
33
	public $type = '';
34
35 5
	public static function getType(Token $token) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
36 5
		if (isset(self::$typeMap[$token->type])) {
37 5
			return self::$typeMap[$token->type];
38
		}
39
	}
40
}
41