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

BaseFormatter::visitToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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