src/Block/Group.php
public function stats()
    {
        if ($this->_stats !== null) {
            return $this->_stats;
        }

        Suite::push($this);

        $builder = function ($block) {
            $block->load();
            $normal = 0;
            $inactive = 0;
            $focused = 0;
            $excluded = 0;

            foreach ($block->children() as $child) {
                if ($block->excluded()) {
                    $child->type('exclude');
                }
                if ($child instanceof Group) {
                    $result = $child->stats();
                    if ($child->focused() && !$result['focused']) {
                        $focused += $result['normal'];
                        $excluded += $result['excluded'];
                        $child->broadcastFocus();
                    } elseif (!$child->enabled()) {
                        $inactive += $result['normal'];
                        $focused += $result['focused'];
                        $excluded += $result['excluded'];
                    } else {
                        $normal += $result['normal'];
                        $focused += $result['focused'];
                        $excluded += $result['excluded'];
                    }
                } else {
                    switch ($child->type()) {
                        case 'exclude':
                            $excluded++;
                            break;
                        case 'focus':
                            $focused++;
                            break;
                        default:
                            $normal++;
                            break;
                    }
                }
            }
            return compact('normal', 'inactive', 'focused', 'excluded');
        };

        if (Suite::$PHP >= 7 && !defined('HHVM_VERSION')) {
            try {
                $stats = $builder($this);
            } catch (Throwable $exception) {
                $this->log()->type('errored');
                $this->log()->exception($exception);

                $stats = [
                    'normal' => 0,
                    'focused' => 0,
                    'excluded' => 0
                ];
            }
        } else {
            $stats = $builder($this);
        }

        Suite::pop();
        return $stats;
    }
public function stats()
    {
        if ($this->_stats !== null) {
            return $this->_stats;
        }

        Suite::push($this);

        $builder = function ($block) {
            $block->load();
            $normal = 0;
            $inactive = 0;
            $focused = 0;
            $excluded = 0;

            foreach ($block->children() as $child) {
                if ($block->excluded()) {
                    $child->type('exclude');
                }
                if ($child instanceof Group) {
                    $result = $child->stats();
                    if ($child->focused() && !$result['focused']) {
                        $focused += $result['normal'];
                        $excluded += $result['excluded'];
                        $child->broadcastFocus();
                    } elseif (!$child->enabled()) {
                        $inactive += $result['normal'];
                        $focused += $result['focused'];
                        $excluded += $result['excluded'];
                    } else {
                        $normal += $result['normal'];
                        $focused += $result['focused'];
                        $excluded += $result['excluded'];
                    }
                } else {
                    switch ($child->type()) {
                        case 'exclude':
                            $excluded++;
                            break;
                        case 'focus':
                            $focused++;
                            break;
                        default:
                            $normal++;
                            break;
                    }
                }
            }
            return compact('normal', 'inactive', 'focused', 'excluded');
        };

        if (Suite::$PHP >= 7 && !defined('HHVM_VERSION')) {
            try {
                $stats = $builder($this);
            } catch (Throwable $exception) {
                $this->log()->type('errored');
                $this->log()->exception($exception);

                $stats = [
                    'normal' => 0,
                    'focused' => 0,
                    'excluded' => 0
                ];
            }
        } else {
            $stats = $builder($this);
        }

        Suite::pop();
        return $stats;
    }
public function stats ( ) { if ( $ this -> _stats !== null ) { return $ this -> _stats ; } Suite :: push ( $ this ) ; $ builder = function ( $ block ) { $ block -> load ( ) ; $ normal = 0 ; $ inactive = 0 ; $ focused = 0 ; $ excluded = 0 ; foreach ( $ block -> children ( ) as $ child ) { if ( $ block -> excluded ( ) ) { $ child -> type ( 'exclude' ) ; } if ( $ child instanceof Group ) { $ result = $ child -> stats ( ) ; if ( $ child -> focused ( ) && ! $ result [ 'focused' ] ) { $ focused += $ result [ 'normal' ] ; $ excluded += $ result [ 'excluded' ] ; $ child -> broadcastFocus ( ) ; } elseif ( ! $ child -> enabled ( ) ) { $ inactive += $ result [ 'normal' ] ; $ focused += $ result [ 'focused' ] ; $ excluded += $ result [ 'excluded' ] ; } else { $ normal += $ result [ 'normal' ] ; $ focused += $ result [ 'focused' ] ; $ excluded += $ result [ 'excluded' ] ; } } else { switch ( $ child -> type ( ) ) { case 'exclude' : $ excluded ++ ; break ; case 'focus' : $ focused ++ ; break ; default : $ normal ++ ; break ; } } } return compact ( 'normal' , 'inactive' , 'focused' , 'excluded' ) ; } ; if ( Suite :: $ PHP >= 7 && ! defined ( 'HHVM_VERSION' ) ) { try { $ stats = $ builder ( $ this ) ; } catch ( Throwable $ exception ) { $ this -> log ( ) -> type ( 'errored' ) ; $ this -> log ( ) -> exception ( $ exception ) ; $ stats = [ 'normal' => 0 , 'focused' => 0 , 'excluded' => 0 ] ; } } else { $ stats = $ builder ( $ this ) ; } Suite :: pop ( ) ; return $ stats ; }
Builds the group stats.

@return array The group stats.
Builds the group stats .