You are here

private function crumbs_DIC_AbstractServiceContainer::createService in Crumbs, the Breadcrumbs suite 7.2

Parameters

string $name:

Return value

object The service.

Throws

Exception

1 call to crumbs_DIC_AbstractServiceContainer::createService()
crumbs_DIC_AbstractServiceContainer::__get in lib/DIC/AbstractServiceContainer.php
Magic method that is triggered when someone calls $container->$name.

File

lib/DIC/AbstractServiceContainer.php, line 36

Class

crumbs_DIC_AbstractServiceContainer
Dependency injection container for lazy-instantiated services.

Code

private function createService($name) {

  // Method to be implemented in a subclass.
  $method = $name;
  if (!method_exists($this, $method)) {
    throw new \Exception("Unknown service '{$name}'.");
  }
  return $this
    ->{$method}();
}