src/Knp/Menu/Util/MenuManipulator.php
public function getBreadcrumbsArray(ItemInterface $item, $subItem = null)
    {
        $breadcrumbs = $this->buildBreadcrumbsArray($item);

        if (null === $subItem) {
            return $breadcrumbs;
        }

        if ($subItem instanceof ItemInterface) {
            $breadcrumbs[] = $this->getBreadcrumbsItem($subItem);

            return $breadcrumbs;
        }

        if (!is_array($subItem) && !$subItem instanceof \Traversable) {
            $subItem = array($subItem);
        }

        foreach ($subItem as $key => $value) {
            switch (true) {
                case $value instanceof ItemInterface:
                    $value = $this->getBreadcrumbsItem($value);
                    break;

                case is_array($value):
                    // Assume we already have the appropriate array format for the element
                    break;

                case is_integer($key) && is_string($value):
                    $value = array(
                        'label' => (string) $value,
                        'uri' => null,
                        'item' => null,
                    );
                    break;

                case is_scalar($value):
                    $value = array(
                        'label' => (string) $key,
                        'uri' => (string) $value,
                        'item' => null,
                    );
                    break;

                case null === $value:
                    $value = array(
                        'label' => (string) $key,
                        'uri' => null,
                        'item' => null,
                    );
                    break;

                default:
                    throw new \InvalidArgumentException(sprintf('Invalid value supplied for the key "%s". It should be an item, an array or a scalar', $key));
            }

            $breadcrumbs[] = $value;
        }

        return $breadcrumbs;
    }
public function getBreadcrumbsArray(ItemInterface $item, $subItem = null)
    {
        $breadcrumbs = $this->buildBreadcrumbsArray($item);

        if (null === $subItem) {
            return $breadcrumbs;
        }

        if ($subItem instanceof ItemInterface) {
            $breadcrumbs[] = $this->getBreadcrumbsItem($subItem);

            return $breadcrumbs;
        }

        if (!is_array($subItem) && !$subItem instanceof \Traversable) {
            $subItem = array($subItem);
        }

        foreach ($subItem as $key => $value) {
            switch (true) {
                case $value instanceof ItemInterface:
                    $value = $this->getBreadcrumbsItem($value);
                    break;

                case is_array($value):
                    // Assume we already have the appropriate array format for the element
                    break;

                case is_integer($key) && is_string($value):
                    $value = array(
                        'label' => (string) $value,
                        'uri' => null,
                        'item' => null,
                    );
                    break;

                case is_scalar($value):
                    $value = array(
                        'label' => (string) $key,
                        'uri' => (string) $value,
                        'item' => null,
                    );
                    break;

                case null === $value:
                    $value = array(
                        'label' => (string) $key,
                        'uri' => null,
                        'item' => null,
                    );
                    break;

                default:
                    throw new \InvalidArgumentException(sprintf('Invalid value supplied for the key "%s". It should be an item, an array or a scalar', $key));
            }

            $breadcrumbs[] = $value;
        }

        return $breadcrumbs;
    }
Renders an array ready to be used for breadcrumbs.

Each element in the array will be an array with 3 keys:
- `label` containing the label of the item
- `url` containing the url of the item (may be `null`)
- `item` containing the original item (may be `null` for the extra items)

The subItem can be one of the following forms
* 'subItem'
* ItemInterface object
* array('subItem' => '@homepage')
* array('subItem1', 'subItem2')
* array(array('label' => 'subItem1', 'url' => '@homepage'), array('label' => 'subItem2'))

@param ItemInterface $item
@param mixed         $subItem A string or array to append onto the end of the array

@return array

@throws \InvalidArgumentException if an element of the subItem is invalid