Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
11 / 11
GraphBuilder
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
11 / 11
 __construct(array $cfg, Graph $g, LoggerInterface $log)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
 buildContext()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
3 / 3
 buildCollectors()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
<?php
/*
 * Mondrian
 */
namespace Trismegiste\Mondrian\Transform;
use Trismegiste\Mondrian\Graph\Graph;
use Trismegiste\Mondrian\Visitor;
use Trismegiste\Mondrian\Builder\Compiler\AbstractTraverser;
use Trismegiste\Mondrian\Transform\Logger\LoggerInterface;
/**
 * Design Pattern: Builder
 *
 * GraphBuilder is a builder for a compiler
 *
 */
class GraphBuilder extends AbstractTraverser
{
    protected $graphResult;
    protected $config;
    protected $reflection;
    protected $vertexContext;
    protected $logger;
    /**
     * Injecting the external in/out parameters
     * 
     * @param array $cfg
     * @param \Trismegiste\Mondrian\Graph\Graph $g
     * @param \Trismegiste\Mondrian\Transform\Logger\LoggerInterface $log
     */
    public function __construct(array $cfg, Graph $g, LoggerInterface $log)
    {
        $this->config = $cfg;
        $this->graphResult = $g;
        $this->logger = $log;
    }
    /**
     * Build the context(s) for passes
     */
    public function buildContext()
    {
        $this->reflection = new ReflectionContext();
        $this->vertexContext = new GraphContext($this->config, $this->logger);
    }
    /**
     * Build a list of visitor for each pass
     * 
     * @return FqcnCollector[] list of passes
     */
    public function buildCollectors()
    {
        return array(
            new Visitor\SymbolMap($this->reflection),
            new Visitor\VertexCollector($this->reflection, $this->vertexContext, $this->graphResult),
            new Visitor\EdgeCollector($this->reflection, $this->vertexContext, $this->graphResult)
        );
    }
}