示例#1
0
 /**
  * {@inheritdoc}
  */
 public function getDefinedType($typeName)
 {
     if (!isset($this->types[$typeName])) {
         throw NoSuchTypeException::forTypeName($typeName);
     }
     return $this->types[$typeName];
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function getDefinedType($typeName)
 {
     throw NoSuchTypeException::forTypeName($typeName);
 }
 private function loadType($typeName)
 {
     if (!($type = $this->store->get($typeName))) {
         throw NoSuchTypeException::forTypeName($typeName);
     }
     $this->types[$typeName] = $type;
 }
 /**
  * Returns the bindings for a resource path and type.
  *
  * @param string $resourcePath The resource path.
  * @param string $typeName     The type name.
  *
  * @return ResourceBinding[] The matching bindings.
  */
 protected function findByPathAndType($resourcePath, $typeName)
 {
     if (!isset($this->typeIndex[$typeName])) {
         throw NoSuchTypeException::forTypeName($typeName);
     }
     $bindings = array();
     foreach ($this->queryIndex as $query => $ids) {
         if (!$this->resourcePathMatchesQuery($resourcePath, $query)) {
             continue;
         }
         foreach ($ids as $id => $true) {
             // Prevent duplicate type comparisons
             if (isset($bindings[$id])) {
                 continue;
             }
             $binding = $this->getBinding($id);
             if ($typeName === $binding->getType()->getName()) {
                 $bindings[$id] = $this->getBinding($id);
             }
         }
     }
     return array_values($bindings);
 }