src/Knp/Menu/Loader/ArrayLoader.php
private function fromArray(array $data, $name = null)
    {
        $name = isset($data['name']) ? $data['name'] : $name;

        if (isset($data['children'])) {
            $children = $data['children'];
            unset($data['children']);
        } else {
            $children = array();
        }

        $item = $this->factory->createItem($name, $data);

        foreach ($children as $name => $child) {
            $item->addChild($this->fromArray($child, $name));
        }

        return $item;
    }
private function fromArray(array $data, $name = null)
    {
        $name = isset($data['name']) ? $data['name'] : $name;

        if (isset($data['children'])) {
            $children = $data['children'];
            unset($data['children']);
        } else {
            $children = array();
        }

        $item = $this->factory->createItem($name, $data);

        foreach ($children as $name => $child) {
            $item->addChild($this->fromArray($child, $name));
        }

        return $item;
    }
private function fromArray ( array $ data , $ name = null ) { $ name = isset ( $ data [ 'name' ] ) ? $ data [ 'name' ] : $ name ; if ( isset ( $ data [ 'children' ] ) ) { $ children = $ data [ 'children' ] ; unset ( $ data [ 'children' ] ) ; } else { $ children = array ( ) ; } $ item = $ this -> factory -> createItem ( $ name , $ data ) ; foreach ( $ children as $ name => $ child ) { $ item -> addChild ( $ this -> fromArray ( $ child , $ name ) ) ; } return $ item ; }
@param array       $data
@param string|null $name (the name of the item, used only if there is no name in the data themselves)

@return ItemInterface
@param array $data @param string|null $name ( the name of the item used only if there is no name in the data themselves )