/** * 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; }
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)); }