예제 #1
0
파일: Container.php 프로젝트: khelle/surume
 /**
  * @param string $alias
  * @param mixed[] $definition
  * @throws IoWriteException
  */
 public function singleton($alias, $definition = [])
 {
     $object = null;
     try {
         $object = $this->container->singleton($alias);
     } catch (Error $ex) {
         throw new IoWriteException("Binding singleton of [{$alias}] to Container failed.", $ex);
     } catch (Exception $ex) {
         throw new IoWriteException("Binding singleton of [{$alias}] to Container failed.", $ex);
     }
     if ($object === null) {
         throw new IoWriteException("Binding singleton of [{$alias}] to Container failed.");
     }
     $object->withArguments($definition);
 }