예제 #1
0
파일: App.php 프로젝트: neatphp/neat
 /**
  * Retrieves the services.
  *
  * @param string $name
  *
  * @return Container|mixed
  */
 public function getServices($name = null)
 {
     if (!$this->services) {
         $path = $this->basedir . '/etc/config/services.php';
         $this->services = new Container(require $path);
         $this->services->set('app', $this);
         $this->services->set('Neat\\Loader\\ClassLoader', $this->getLoader());
     }
     return isset($name) ? $this->services->get($name) : $this->services;
 }
예제 #2
0
 public function testSet_withExistingIdAndReadonly_throwsException()
 {
     $this->subject->get(Service1::class);
     $this->setExpectedException('Neat\\Container\\Exception\\ReadonlyException');
     $this->subject->set(Service1::class, Definition::object(Service2::class));
 }