Completed
Push — master ( fef961...cb7bad )
by Thomas
01:47
created

IndentationFormatter::indentOpenCurlyBrace()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
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 2
	protected function doVisitToken(Token $token) {
9 2
		$this->indentOpenCurlyBrace($token);
10 2
		$this->indentCloseCurlyBrace($token);
11 2
	}
12
13 2
	private function indentOpenCurlyBrace(Token $token) {
14 2
		if ($token->contents == '{') {
15 2
			$this->defaultFormatter->addPostIndent();
16
		}
17 2
	}
18
19 2
	private function indentCloseCurlyBrace(Token $token) {
20 2
		if ($token->contents == '}') {
21 2
			$this->defaultFormatter->addPreOutdent();
22
		}
23 2
	}
24
25
}
26