Kahlan\Reporter\Coverage\Metrics::__construct PHP Method

__construct() public method

Constructor
public __construct ( array $options = [] )
$options array Possible options values are: - `'name'` _string_ : the string name reference of the metrics. - `'type'` _string_ : the type of the metrics is about. - `'parent'` _instance_: reference to the parent metrics.
    public function __construct($options = [])
    {
        $defaults = ['name' => '', 'type' => 'namespace', 'parent' => null];
        $options += $defaults;
        $this->_parent = $options['parent'];
        $this->_type = $options['type'];
        if (!$this->_parent) {
            $this->_name = $options['name'];
            return;
        }
        $pname = $this->_parent->name();
        switch ($this->_type) {
            case 'namespace':
            case 'function':
            case 'trait':
            case 'class':
                $this->_name = $pname ? $pname . $options['name'] : $options['name'];
                break;
            case 'method':
                $this->_name = $pname ? $pname . '::' . $options['name'] : $options['name'];
                break;
        }
    }