protected function getItemByTypeAndIndex($type, $index)
    {
        $typeItems = $this->getItems($type);

        // If the item index is out of bounds
        if (count($typeItems) <= $index) {
            throw new OutOfBoundsException(
                sprintf(OutOfBoundsException::INVALID_ITEM_INDEX_STR, $index),
                OutOfBoundsException::INVALID_ITEM_INDEX
            );
        }

        return $typeItems[$index];
    }