/**
  * @inheritDoc
  */
 public function get(ResourceIdentifierInterface $identifier)
 {
     /** @var ResourceInterface $resource */
     foreach ($this as $resource) {
         if ($identifier->isSame($resource->getIdentifier())) {
             return $resource;
         }
     }
     throw new RuntimeException('No matching resource in collection: ' . $identifier->toString());
 }
Ejemplo n.º 2
0
 /**
  * @param ResourceIdentifierInterface $identifier
  * @return object|bool|null
  */
 private function lookup(ResourceIdentifierInterface $identifier)
 {
     $key = $identifier->toString();
     return isset($this->map[$key]) ? $this->map[$key] : null;
 }