src/Reporter/Coverage.php
protected function _getMetricsReport($children, $verbosity, $depth = 0, $tab = 3, &$maxWidth = null)
    {
        $list = [];
        foreach ($children as $child) {
            $type = $child->type();

            if ($verbosity === 2 && $type !== 'namespace') {
                continue;
            }
            if ($verbosity === 3 && ($type === 'function' || $type === 'method')) {
                continue;
            }

            $name = $child->name();

            if ($name !== '\\') {
                $pos = strrpos($name, '\\', $type === 'namespace' ? - 2 : 0);
                $basename = substr($name, $pos !== false ? $pos + 1 : 0);
            } else {
                $basename = '\\';
            }

            $len = strlen($basename) + ($depth + 1) * $tab;
            if ($len > $maxWidth) {
                $maxWidth = $len;
            }
            $list[$basename] = [
                'metrics'  => $child,
                'children' => $this->_getMetricsReport($child->children(), $verbosity, $depth + 1, $tab, $maxWidth)
            ];
        }
        return $list;
    }
protected function _getMetricsReport($children, $verbosity, $depth = 0, $tab = 3, &$maxWidth = null)
    {
        $list = [];
        foreach ($children as $child) {
            $type = $child->type();

            if ($verbosity === 2 && $type !== 'namespace') {
                continue;
            }
            if ($verbosity === 3 && ($type === 'function' || $type === 'method')) {
                continue;
            }

            $name = $child->name();

            if ($name !== '\\') {
                $pos = strrpos($name, '\\', $type === 'namespace' ? - 2 : 0);
                $basename = substr($name, $pos !== false ? $pos + 1 : 0);
            } else {
                $basename = '\\';
            }

            $len = strlen($basename) + ($depth + 1) * $tab;
            if ($len > $maxWidth) {
                $maxWidth = $len;
            }
            $list[$basename] = [
                'metrics'  => $child,
                'children' => $this->_getMetricsReport($child->children(), $verbosity, $depth + 1, $tab, $maxWidth)
            ];
        }
        return $list;
    }
protected function _getMetricsReport ( $ children , $ verbosity , $ depth = 0 , $ tab = 3 , & $ maxWidth = null ) { $ list = [ ] ; foreach ( $ children as $ child ) { $ type = $ child -> type ( ) ; if ( $ verbosity === 2 && $ type !== 'namespace' ) { continue ; } if ( $ verbosity === 3 && ( $ type === 'function' || $ type === 'method' ) ) { continue ; } $ name = $ child -> name ( ) ; if ( $ name !== '\\' ) { $ pos = strrpos ( $ name , '\\' , $ type === 'namespace' ? - 2 : 0 ) ; $ basename = substr ( $ name , $ pos !== false ? $ pos + 1 : 0 ) ; } else { $ basename = '\\' ; } $ len = strlen ( $ basename ) + ( $ depth + 1 ) * $ tab ; if ( $ len > $ maxWidth ) { $ maxWidth = $ len ; } $ list [ $ basename ] = [ 'metrics' => $ child , 'children' => $ this -> _getMetricsReport ( $ child -> children ( ) , $ verbosity , $ depth + 1 , $ tab , $ maxWidth ) ] ; } return $ list ; }
Extract some metrics reports to display according to a verbosity parameter.

@param array  $children  A array of metrics.
@param mixed  $verbosity The options for the reporter, the options are:
- `'verbosity`' _integer|string_: The verbosity level:
- 1      : overall coverage value for the whole code.
- 2      : overall coverage by namespaces.
- 3      : overall coverage by classes.
- 4      : overall coverage by methods and functions.
- string : coverage for a fully namespaced (class/method/namespace) string.
@param integer $depth    The actual depth in the reporting.
@param integer $tab      The size of the tab used for lablels.
@param integer $maxWidth Will contain the maximum width obtained for labels.

@return array
Extract some metrics reports to display according to a verbosity parameter .