public function unshift($path, $value)
    {
        $node = $this->get($path);

        if (!$node) {
            $node = [];
        } elseif (\is_object($node)) {
            $node = get_object_vars($node);
        }

        if (!\is_array($node)) {
            throw new \UnexpectedValueException(
                sprintf(
                    'The value at path: %s should be object or array but is %s.',
                    $path,
                    gettype($node)
                )
            );
        }

        $args = \func_get_args();

        if (\count($args) <= 2) {
            $key = array_unshift($node, $value);
        } else {
            $args[0] = &$node;

            $key = call_user_func_array('array_unshift', $args);
        }

        $this->set($path, $node);

        return $key;
    }
public function unshift($path, $value)
    {
        $node = $this->get($path);

        if (!$node) {
            $node = [];
        } elseif (\is_object($node)) {
            $node = get_object_vars($node);
        }

        if (!\is_array($node)) {
            throw new \UnexpectedValueException(
                sprintf(
                    'The value at path: %s should be object or array but is %s.',
                    $path,
                    gettype($node)
                )
            );
        }

        $args = \func_get_args();

        if (\count($args) <= 2) {
            $key = array_unshift($node, $value);
        } else {
            $args[0] = &$node;

            $key = call_user_func_array('array_unshift', $args);
        }

        $this->set($path, $node);

        return $key;
    }
public function unshift ( $ path , $ value ) { $ node = $ this -> get ( $ path ) ; if ( ! $ node ) { $ node = [ ] ; } elseif ( \ is_object ( $ node ) ) { $ node = get_object_vars ( $ node ) ; } if ( ! \ is_array ( $ node ) ) { throw new \ UnexpectedValueException ( sprintf ( 'The value at path: %s should be object or array but is %s.' , $ path , gettype ( $ node ) ) ) ; } $ args = \ func_get_args ( ) ; if ( \ count ( $ args ) <= 2 ) { $ key = array_unshift ( $ node , $ value ) ; } else { $ args [ 0 ] = & $ node ; $ key = call_user_func_array ( 'array_unshift' , $ args ) ; } $ this -> set ( $ path , $ node ) ; return $ key ; }
Prepend value to a path in structure.

@param   string $path  Parent structure Path (e.g. windwalker.content.showauthor)
@param   mixed  $value Value of entry, one or more elements.

@return  integer  the new number of elements in the array.

@since   2.1
Prepend value to a path in structure .