BaseFormatter::visitToken()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

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