private function castMenu($menu)
    {
        if (!$menu instanceof ItemInterface) {
            $path = array();
            if (is_array($menu)) {
                if (empty($menu)) {
                    throw new \InvalidArgumentException('The array cannot be empty');
                }
                $path = $menu;
                $menu = array_shift($path);
            }

            return $this->get($menu, $path);
        }

        return $menu;
    }
private function castMenu($menu)
    {
        if (!$menu instanceof ItemInterface) {
            $path = array();
            if (is_array($menu)) {
                if (empty($menu)) {
                    throw new \InvalidArgumentException('The array cannot be empty');
                }
                $path = $menu;
                $menu = array_shift($path);
            }

            return $this->get($menu, $path);
        }

        return $menu;
    }
private function castMenu ( $ menu ) { if ( ! $ menu instanceof ItemInterface ) { $ path = array ( ) ; if ( is_array ( $ menu ) ) { if ( empty ( $ menu ) ) { throw new \ InvalidArgumentException ( 'The array cannot be empty' ) ; } $ path = $ menu ; $ menu = array_shift ( $ path ) ; } return $ this -> get ( $ menu , $ path ) ; } return $ menu ; }
@param ItemInterface|array|string $menu

@return ItemInterface
@param ItemInterface|array|string $menu