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

IndentationFormatter::doVisitToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
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 phootwork\tokenizer\Token;
5
6
class IndentationFormatter extends SpecializedFormatter {
7
8
	protected function doVisitToken(Token $token) {
9
		$this->indentOpenCurlyBrace($token);
10
		$this->indentCloseCurlyBrace($token);
11
	}
12
13
	private function indentOpenCurlyBrace(Token $token) {
14
		if ($token->contents == '{') {
15
			$this->defaultFormatter->addPostIndent();
16
		}
17
	}
18
19
	private function indentCloseCurlyBrace(Token $token) {
20
		if ($token->contents == '}') {
21
			$this->defaultFormatter->addPreOutdent();
22
		}
23
	}
24
25
}
26