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

IndentationFormatter   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 20
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A doVisitToken() 0 4 1
A indentOpenCurlyBrace() 0 5 2
A indentCloseCurlyBrace() 0 5 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