Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 17
Director
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 5
30
0.00% covered (danger)
0.00%
0 / 17
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 5
 getConfig
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 getNewConfig
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 getMatcher
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 getUrlGenerator
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
<?php
/**
 * Director
 *
 * A general purpose url router and generator
 *
 * @package     Director
 * @author      Timothy J. Warren
 * @copyright   Copyright (c) 2016
 * @link        https://git.timshomepage.net/timw4mail/director
 * @license     MIT
 */
namespace Aviat\Director;
use Psr\Log\LoggerInterface;
/**
 * Library entry point
 */
class Director {
    /**
     * Route configuration
     *
     * @var RouteConfig
     */
    protected $config;
    
    /**
     * Url Generator 
     *
     * @var UrlGenerator
     */
    protected $urlGenerator;
    
    /**
     * Route matcher
     *
     * @var Matcher
     */
    protected $matcher;
    
    /**
     * Logger
     *
     * @var LoggerInterface
     */
    protected $logger;
    
    /**
     * Constructor
     *
     * @param [array] $config - The full route configuration
     */
    public function __construct(array $config = [])
    {
        $this->config = $this->getNewConfig();
        $this->matcher = $this->getMatcher();
        $this->urlGenerator = $this->getUrlGenerator();
    }
    
    /**
     * Return the config option
     *
     * @return RouteConfig
     */
    public function getConfig()
    {
        return $this->config;
    }
    
    /**
     * Create config object
     *
     * @return RouteConfig
     */
    protected function getNewConfig()
    {
        return new RouteConfig();
    }
    
    /**
     * Create matcher object
     *
     * @return Matcher
     */
    protected function getMatcher()
    {
        return new Matcher($this->config);
    }
    
    /**
     * Create url generator
     *
     * @return UrlGenerator
     */
    protected function getUrlGenerator()
    {
        return new UrlGenerator($this->config);
    }
}