BaseFormatter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A visitToken() 0 6 1
A doVisitToken() 0 3 1
A init() 0 3 1
1
<?php
2
namespace gossi\formatter\formatters;
3
4
use gossi\code\profiles\Profile;
5
use gossi\formatter\parser\Context;
6
use gossi\formatter\parser\Parser;
7
use gossi\formatter\parser\TokenMatcher;
8
use gossi\formatter\utils\Writer;
9
use phootwork\tokenizer\Token;
10
use phootwork\tokenizer\TokenVisitorInterface;
11
12
class BaseFormatter implements TokenVisitorInterface {
13
14
	/** @var Parser */
15
	protected $parser;
16
	/** @var Profile */
17
	protected $config;
18
	/** @var Writer */
19
	protected $writer;
20
	/** @var Context */
21
	protected $context;
22
	/** @var TokenMatcher */
23
	protected $matcher;
24
25
	protected $nextToken;
26
	protected $prevToken;
27
28 2
	public function __construct(Parser $parser, Profile $profile, Writer $writer) {
29 2
		$this->config = $profile;
30 2
		$this->writer = $writer;
31 2
		$this->parser = $parser;
32 2
		$this->context = $parser->getContext();
33 2
		$this->matcher = $parser->getMatcher();
34
35 2
		$this->init();
36 2
	}
37
38 2
	public function visitToken(Token $token) {
39 2
		$this->nextToken = $this->parser->getTracker()->getNextToken();
40 2
		$this->prevToken = $this->parser->getTracker()->getPrevToken();
41
42 2
		$this->doVisitToken($token);
43 2
	}
44
45 2
	protected function doVisitToken(Token $token) {
46
47 2
	}
48
49 2
	protected function init() {
50
51 2
	}
52
53
}
54