1 | <?php |
||
10 | class DelegateFormatter implements TokenVisitorInterface { |
||
11 | |||
12 | /** @var Profile */ |
||
13 | protected $profile; |
||
14 | |||
15 | /** @var Writer */ |
||
16 | protected $writer; |
||
17 | |||
18 | /** @var Parser */ |
||
19 | protected $parser; |
||
20 | |||
21 | // formatters |
||
22 | private $defaultFormatter; |
||
23 | private $commentsFormatter; |
||
24 | private $indentationFormatter; |
||
25 | private $newlineFormatter; |
||
26 | private $whitespaceFormatter; |
||
27 | private $blanksFormatter; |
||
28 | |||
29 | 2 | public function __construct(Parser $parser, Profile $profile) { |
|
45 | |||
46 | 2 | public function format() { |
|
51 | |||
52 | 2 | public function visitToken(Token $token) { |
|
53 | 2 | $this->parser->getTracker()->visitToken($token); |
|
54 | |||
55 | // visit all rules |
||
56 | 2 | $this->commentsFormatter->visitToken($token); |
|
57 | 2 | $this->indentationFormatter->visitToken($token); |
|
58 | 2 | $this->newlineFormatter->visitToken($token); |
|
59 | 2 | $this->whitespaceFormatter->visitToken($token); |
|
60 | 2 | $this->blanksFormatter->visitToken($token); |
|
61 | 2 | $this->defaultFormatter->visitToken($token); |
|
62 | 2 | } |
|
63 | |||
64 | 2 | public function getCode() { |
|
67 | |||
68 | } |
||
69 |