Completed
Push — master ( f4bdff...fef961 )
by Thomas
01:46
created

BaseFormatter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 42
ccs 0
cts 17
cp 0
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
13
class BaseFormatter implements TokenVisitorInterface {
14
15
	/** @var Parser */
16
	protected $parser;
17
	/** @var Profile */
18
	protected $config;
19
	/** @var Writer */
20
	protected $writer;
21
	/** @var Context */
22
	protected $context;
23
	/** @var TokenMatcher */
24
	protected $matcher;
25
26
	protected $nextToken;
27
	protected $prevToken;
28
29
	public function __construct(Parser $parser, Profile $profile, Writer $writer) {
30
		$this->config = $profile;
31
		$this->writer = $writer;
32
		$this->parser = $parser;
33
		$this->context = $parser->getContext();
34
		$this->matcher = $parser->getMatcher();
35
36
		$this->init();
37
	}
38
39
	public function visitToken(Token $token) {
40
		$this->nextToken = $this->parser->getTracker()->getNextToken();
41
		$this->prevToken = $this->parser->getTracker()->getPrevToken();
42
43
		$this->doVisitToken($token);
44
	}
45
46
	protected function doVisitToken(Token $token) {
47
48
	}
49
50
	protected function init() {
51
52
	}
53
54
}
55