Example #1
0
 /**
  * Pick a lifecycle for the given type from the available candidates.
  *
  * @param string   $type          type
  * @param string[] $candidates    list of types that can satisfy this type
  * @return Lifecycle              A lifecycle object for this type
  *
  * @throws exception\CannotFindImplementation
  */
 public function pickFactory($type, $candidates)
 {
     if (count($candidates) == 0) {
         throw new CannotFindImplementation($type);
     } elseif ($preference = $this->preferFrom($candidates)) {
         return $preference;
     } else {
         return $this->parent->pickFactory($type, $candidates);
     }
 }