private function end($name)
    {
        $this->last = $this->names->pop();
        if (! is_null($name) && $this->last !== $name) {
            $n = is_string($name) ? $name : 'a bad';
            $msg = 'You tried to close %s section where you should have closed %s.';
            throw new InvalidArgumentException(sprintf($msg, $n, $this->last));
        }

        return $this->stack->pop();
    }
private function end($name)
    {
        $this->last = $this->names->pop();
        if (! is_null($name) && $this->last !== $name) {
            $n = is_string($name) ? $name : 'a bad';
            $msg = 'You tried to close %s section where you should have closed %s.';
            throw new InvalidArgumentException(sprintf($msg, $n, $this->last));
        }

        return $this->stack->pop();
    }
private function end ( $ name ) { $ this -> last = $ this -> names -> pop ( ) ; if ( ! is_null ( $ name ) && $ this -> last !== $ name ) { $ n = is_string ( $ name ) ? $ name : 'a bad' ; $ msg = 'You tried to close %s section where you should have closed %s.' ; throw new InvalidArgumentException ( sprintf ( $ msg , $ n , $ this -> last ) ) ; } return $ this -> stack -> pop ( ) ; }
Ends a section. If a name is provided checks that the name provided is the right one.

@param string|void Section to close
@return \Foil\Contracts\SectionInterface
@throws InvalidArgumentException         If provided name is not the section to be closed.
Ends a section . If a name is provided checks that the name provided is the right one .