/**
  * {@inheritdoc}
  */
 public function getItemFromIri($iri, $fetchData = false)
 {
     try {
         $parameters = $this->router->match($iri);
     } catch (ResourceNotFoundException $e) {
         return;
     }
     if (!isset($parameters['_resource']) || !isset($parameters['id']) || !($resource = $this->resourceCollection->getResourceForShortName($parameters['_resource']))) {
         throw new \InvalidArgumentException(sprintf('No resource associated with the IRI "%s".', $iri));
     }
     return $this->dataProvider->getItem($resource, $parameters['id'], $fetchData);
 }
 /**
  * {@inheritdoc}
  */
 public function getItemFromIri($iri, $fetchData = false)
 {
     try {
         $parameters = $this->router->match($iri);
     } catch (ExceptionInterface $e) {
         throw new InvalidArgumentException(sprintf('No route matches "%s".', $iri), $e->getCode(), $e);
     }
     if (!isset($parameters['_resource']) || !isset($parameters['id']) || !($resource = $this->resourceCollection->getResourceForShortName($parameters['_resource']))) {
         throw new InvalidArgumentException(sprintf('No resource associated to "%s".', $iri));
     }
     if ($item = $this->dataProvider->getItem($resource, $parameters['id'], $fetchData)) {
         return $item;
     }
     throw new InvalidArgumentException(sprintf('Item not found for "%s".', $iri));
 }
 /**
  * Gets an item using the data provider. Throws a 404 error if not found.
  *
  * @param DataProviderInterface $dataProvider
  * @param ResourceInterface     $resourceType
  * @param string|int            $id
  *
  * @return object
  *
  * @throws NotFoundHttpException
  */
 private function getItem(DataProviderInterface $dataProvider, ResourceInterface $resourceType, $id)
 {
     $data = $dataProvider->getItem($resourceType, $id, true);
     if (!$data) {
         throw new NotFoundHttpException();
     }
     return $data;
 }