public function addLoop($data)
    {
        $length = is_array($data) || $data instanceof Countable ? count($data) : null;

        $parent = Arr::last($this->loopsStack);

        $this->loopsStack[] = [
            'iteration' => 0,
            'index'     => 0,
            'remaining' => isset($length) ? $length : null,
            'count'     => $length,
            'first'     => true,
            'last'      => isset($length) ? $length === 1 : null,
            'depth'     => count($this->loopsStack) + 1,
            'parent'    => $parent ? (object) $parent : null,
        ];
    }
public function addLoop($data)
    {
        $length = is_array($data) || $data instanceof Countable ? count($data) : null;

        $parent = Arr::last($this->loopsStack);

        $this->loopsStack[] = [
            'iteration' => 0,
            'index'     => 0,
            'remaining' => isset($length) ? $length : null,
            'count'     => $length,
            'first'     => true,
            'last'      => isset($length) ? $length === 1 : null,
            'depth'     => count($this->loopsStack) + 1,
            'parent'    => $parent ? (object) $parent : null,
        ];
    }
public function addLoop ( $ data ) { $ length = is_array ( $ data ) || $ data instanceof Countable ? count ( $ data ) : null ; $ parent = Arr :: last ( $ this -> loopsStack ) ; $ this -> loopsStack [ ] = [ 'iteration' => 0 , 'index' => 0 , 'remaining' => isset ( $ length ) ? $ length : null , 'count' => $ length , 'first' => true , 'last' => isset ( $ length ) ? $ length === 1 : null , 'depth' => count ( $ this -> loopsStack ) + 1 , 'parent' => $ parent ? ( object ) $ parent : null , ] ; }
Add new loop to the stack.

@param array|\Countable $data

@return void
Add new loop to the stack .