private function __construct(Application $app) { $this->app = $app; if (!$this->name) { //throw new Exception(sprintf('The name of service %s is not defined', static::class)); throw new Exception(sprintf('The name of service %s is not defined', get_called_class())); } $app->addService($this->name, $this); }