Returns the provider supporting the subject or item.

@param $subjectOrOrderItem
@return \Ekyna\Bundle\OrderBundle\Provider\ItemProviderInterface
@throws InvalidArgumentException
505003
private function getProvider($subjectOrOrderItem)
    {
        foreach ($this->registry->getProviders() as $provider) {
            if ($provider->supports($subjectOrOrderItem)) {
                return $provider;
            }
        }

        throw new InvalidArgumentException('Unsupported subject.');
    }
622206
public function get($resource)
    {
        if (!array_key_exists($resource, $this->resources)) {
            throw new \InvalidArgumentException(sprintf('This resource "%s" does not exist.', $resource));
        }

        $class = $this->resources[$resource];

        return new $class($this->client);
    }
916938
public function upsertToIndex($subject)
    {
        if ($subject instanceof Searchable) {
            $subject = [$subject];
        }

        if (is_array($subject) || $subject instanceof Traversable) {
            $searchIndexPayload = collect($subject)
                ->each(function ($item) {
                    if (!$item instanceof Searchable) {
                        throw new InvalidArgumentException();
                    }
                })
                ->map(function ($item) {
                    return array_merge(
                        $item->getSearchableBody(),
                        ['objectID' => $this->getAlgoliaId($item)]
                    );
                })
                ->toArray();

            $this->index->saveObjects($searchIndexPayload);

            return;
        }

        throw new InvalidArgumentException('Subject must be a searchable or array of searchables');
    }
931071
public function getItemService()
    {
        if (is_null($this->itemService)) {
            $this->itemService = taoItems_models_classes_ItemsService::singleton();
        }
        return $this->itemService;
    }
774710
public function getItems()
    {
        if (!$this->shippingItems) {
            $this->shippingItems = array();
            foreach ($this->entity->getShippingItems() as $shippingItem) {
                $this->shippingItems[] = new ShippingItem(
                    $shippingItem,
                    $this->locale,
                    $this->itemFactory,
                    $this->priceFormatter
                );
            }
        }

        return $this->shippingItems;
    }
778517
protected function supportSubject($subject)
    {
        if (is_object($subject)) {
            return $this->supportClasses(
                $subject,
                array(
                    'OpenOrchestra\ModelInterface\Model\SiteInterface',
                    'OpenOrchestra\ModelInterface\Model\RedirectionInterface',
                    'OpenOrchestra\LogBundle\Model\LogInterface',
                    'OpenOrchestra\UserBundle\Model\UserInterface',
                    'OpenOrchestra\Backoffice\Model\GroupInterface',
                    'OpenOrchestra\ModelInterface\Model\BlockInterface',
                )
            );
        }

        return in_array(
            $subject,
            array(
                SiteInterface::ENTITY_TYPE,
                RedirectionInterface::ENTITY_TYPE,
                LogInterface::ENTITY_TYPE,
                UserInterface::ENTITY_TYPE,
                GroupInterface::ENTITY_TYPE,
                BlockInterface::ENTITY_TYPE,
            )
        );
    }
111491
private function getUrlAdapter(UriInterface $url)
    {
        $embedFactory = $this->embedFactory;
        $url = Url::create((string) $url);

        try {
            $adapter = $embedFactory($url);
        } catch (InvalidUrlException $e) {
            throw new EmbedResolverException($e->getMessage(), 1, $e);
        } catch (EmbedException $e) {
            throw new EmbedResolverException('Provider exception occurred', 2, $e);
        }

        return $adapter;
    }
191989
public function get(CacheableInterface $item)
    {
        if (false !== $result = parent::get($item)) {
            return $result;
        }

        return $this->adapter->get($item);
    }
1309894
public static function providerOf($type = null)
    {
        static::registerProviders();

        if (is_null($type)) {
            return self::$provides;
        }

        if (!isset(self::$provides[$type])) {
            return array();
        }

        return self::$provides[$type];
    }
1097108
protected function supportSubject($subject)
    {
        if (is_object($subject)) {
            return $this->supportClasses(
                $subject,
                array('OpenOrchestra\ModelInterface\Model\ContentInterface')
            );
        }

        return $subject === ContentInterface::ENTITY_TYPE;
    }
963776
public function getItems($order = null)
    {
        if (null === $order) {
            return $this->items;
        }

        return $this->sort($this->items, $order);
    }
7555
public static function items($type)
	{
		if(!isset(self::$_items[$type]))
			self::loadItems($type);
		return self::$_items[$type];
	}
100017
function getItem()
    {
        $sourceObject = $this->sourceObject;
        if ($this->value !== null) {
            $item = $sourceObject::get()->byID($this->value);
        } else {
            $item = $sourceObject::create();
        }
        return $item;
    }
324757
public function getAdapter()
    {
        if ($this->repositoryAdapter instanceof AdapterInterface) {
            return $this->repositoryAdapter;
        }

        foreach ($this->adapters as $adapterClass) {
            if (class_exists($adapterClass) === false || in_array('Accompli\Chrono\Adapter\AdapterInterface', class_implements($adapterClass)) === false) {
                continue;
            }

            $adapter = new $adapterClass($this->repositoryUrl, $this->repositoryDirectory, $this->processExecutor);
            if ($adapter->supportsRepository()) {
                return $adapter;
            }
        }
    }
951060
public function getAdapter($type)
	{
		$type = strtolower($type);

		if (!isset($this->adapters[$type]))
		{
			// Try to load the adapter object
			/* @var  ExtractableInterface  $class */
			$class = 'Joomla\\Archive\\' . ucfirst($type);

			if (!class_exists($class) || !$class::isSupported())
			{
				throw new \InvalidArgumentException(
					sprintf(
						'Archive adapter "%s" (class "%s") not found or supported.',
						$type,
						$class
					)
				);
			}

			$this->adapters[$type] = new $class($this->options);
		}

		return $this->adapters[$type];
	}
906669
public function getOAuthProvider($params)
    {
        if (is_string($params)) {
            $params = array('provider_consumer_key' => $params);
        } else {
            $params = $this->checkFilterParams($params, array('provider_consumer_key'), array('provider_consumer_key'));
            if ($params === false) {
                throw new \InvalidArgumentException("params array contains invalid parameters or misses required parameters");
            }
        }

        return $this->lastRequest->get(null, 'oauth_providers/' . $params[ 'provider_consumer_key' ]);
    }
35438
public function check(SpySalesOrderItem $orderItem)
    {
        $order = $orderItem->getOrder();

        if (isset(self::$resultCache[$this->getName()][$order->getPrimaryKey()])) {
            return self::$resultCache[$this->getName()][$order->getPrimaryKey()];
        }

        $orderTransfer = new OrderTransfer();
        $orderTransfer->fromArray($order->toArray(), true);

        $isSuccess = $this->callFacade($orderTransfer);
        self::$resultCache[$order->getPrimaryKey()] = $isSuccess;

        return $isSuccess;
    }