src/Reporter/Coverage/Metrics.php
public function add($name, $metrics)
    {
        $parts = $this->_parseName($name);
        $this->_merge($metrics);

        $current = $this;
        $length = count($parts);
        foreach ($parts as $index => $part) {
            list($name, $type) = $part;
            if (!isset($current->_children[$name])) {
                $current->_children[$name] = new static([
                    'name'   => $name,
                    'parent' => $current,
                    'type'   => $type
                ]);
            }
            uksort($current->_children, function ($a, $b) {
                $isFunction1 = substr($a, -2) === '()';
                $isFunction2 = substr($b, -2) === '()';
                if ($isFunction1 === $isFunction2) {
                    return strcmp($a, $b);
                }
                return $isFunction1 ? -1 : 1;
            });

            $current = $current->_children[$name];
            $current->_merge($metrics, $index === $length - 1);
        }
    }
public function add($name, $metrics)
    {
        $parts = $this->_parseName($name);
        $this->_merge($metrics);

        $current = $this;
        $length = count($parts);
        foreach ($parts as $index => $part) {
            list($name, $type) = $part;
            if (!isset($current->_children[$name])) {
                $current->_children[$name] = new static([
                    'name'   => $name,
                    'parent' => $current,
                    'type'   => $type
                ]);
            }
            uksort($current->_children, function ($a, $b) {
                $isFunction1 = substr($a, -2) === '()';
                $isFunction2 = substr($b, -2) === '()';
                if ($isFunction1 === $isFunction2) {
                    return strcmp($a, $b);
                }
                return $isFunction1 ? -1 : 1;
            });

            $current = $current->_children[$name];
            $current->_merge($metrics, $index === $length - 1);
        }
    }
public function add ( $ name , $ metrics ) { $ parts = $ this -> _parseName ( $ name ) ; $ this -> _merge ( $ metrics ) ; $ current = $ this ; $ length = count ( $ parts ) ; foreach ( $ parts as $ index => $ part ) { list ( $ name , $ type ) = $ part ; if ( ! isset ( $ current -> _children [ $ name ] ) ) { $ current -> _children [ $ name ] = new static ( [ 'name' => $ name , 'parent' => $ current , 'type' => $ type ] ) ; } uksort ( $ current -> _children , function ( $ a , $ b ) { $ isFunction1 = substr ( $ a , - 2 ) === '()' ; $ isFunction2 = substr ( $ b , - 2 ) === '()' ; if ( $ isFunction1 === $ isFunction2 ) { return strcmp ( $ a , $ b ) ; } return $ isFunction1 ? - 1 : 1 ; } ) ; $ current = $ current -> _children [ $ name ] ; $ current -> _merge ( $ metrics , $ index === $ length - 1 ) ; } }
Adds some metrics to the current metrics.

@param string $name The name reference of the metrics.
Possible values are: `'namespace'`, `'class' or 'function'.
@param array        The metrics array to add.
Adds some metrics to the current metrics .