Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
9 / 9 |
| Director | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
9 / 9 |
| __construct(BuilderInterface $structure) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| compile(array $stmts) | |
100.00% |
1 / 1 |
2 | |
100.00% |
7 / 7 |
|||
| <?php | |
| /* | |
| * Mondrian | |
| */ | |
| namespace Trismegiste\Mondrian\Builder\Compiler; | |
| /** | |
| * Design pattern : Builder | |
| * | |
| * Director makes a compilation/generation/transform with a compiler | |
| */ | |
| class Director | |
| { | |
| private $builder; | |
| /** | |
| * The builder contains the components to create for making the compilation | |
| * | |
| * @param \Trismegiste\Mondrian\Builder\Compiler\BuilderInterface $structure | |
| */ | |
| public function __construct(BuilderInterface $structure) | |
| { | |
| $this->builder = $structure; | |
| } | |
| /** | |
| * Runs the compilation of the parsed statements | |
| * | |
| * @param array $stmts statements to compile | |
| */ | |
| public function compile(array $stmts) | |
| { | |
| $this->builder->buildContext(); | |
| $pass = $this->builder->buildCollectors(); | |
| foreach ($pass as $collector) { | |
| $traverser = $this->builder->buildTraverser($collector); | |
| $traverser->traverse($stmts); | |
| } | |
| } | |
| } |