code: 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;
      }
docs: @param ItemInterface|array|string $menu
  
  @return ItemInterface