public function extract($name = null)
    {
        if ($name instanceof LibBaseTemplateObjectInterface) {
            $name = $name->getName();
        }

        if (is_null($name)) {
            return array_shift($this->_objects);
        } elseif (is_array($name)) {
            $container = clone $this;
            $container->setObjects(array());
            foreach ($name as $key) {
                if ($object = $this->extract($key)) {
                    $container[] = $object;
                }
            }

            return $container;
        } else {
            $object = null;

            if (isset($this->_objects[$name])) {
                $object = $this->_objects[$name];
                unset($this->_objects[$name]);
            }

            return $object;
        }
    }
public function extract($name = null)
    {
        if ($name instanceof LibBaseTemplateObjectInterface) {
            $name = $name->getName();
        }

        if (is_null($name)) {
            return array_shift($this->_objects);
        } elseif (is_array($name)) {
            $container = clone $this;
            $container->setObjects(array());
            foreach ($name as $key) {
                if ($object = $this->extract($key)) {
                    $container[] = $object;
                }
            }

            return $container;
        } else {
            $object = null;

            if (isset($this->_objects[$name])) {
                $object = $this->_objects[$name];
                unset($this->_objects[$name]);
            }

            return $object;
        }
    }
public function extract ( $ name = null ) { if ( $ name instanceof LibBaseTemplateObjectInterface ) { $ name = $ name -> getName ( ) ; } if ( is_null ( $ name ) ) { return array_shift ( $ this -> _objects ) ; } elseif ( is_array ( $ name ) ) { $ container = clone $ this ; $ container -> setObjects ( array ( ) ) ; foreach ( $ name as $ key ) { if ( $ object = $ this -> extract ( $ key ) ) { $ container [ ] = $ object ; } } return $ container ; } else { $ object = null ; if ( isset ( $ this -> _objects [ $ name ] ) ) { $ object = $ this -> _objects [ $ name ] ; unset ( $ this -> _objects [ $ name ] ) ; } return $ object ; } }
Unses a object from the queue using its key and returns it. If an array of
names is passed then a new container is returned. If no name is passed then
return the top element.

@param string|array $name The object name or an array of object names. If name is null
then return the first element

@return LibBaseTemplateObject|LibBaseTemplateObjectContainer
Unses a object from the queue using its key and returns it . If an array of names is passed then a new container is returned . If no name is passed then return the top element .