getEventEmitter() public method

public getEventEmitter ( ) : League\Event\EmitterInterface
return League\Event\EmitterInterface
コード例 #1
0
ファイル: ConfigTest.php プロジェクト: phprest/phprest
 public function testGetters()
 {
     $config = new Config('phprest', 1, true);
     $this->assertEquals('phprest', $config->getVendor());
     $this->assertEquals(1, $config->getApiVersion());
     $this->assertEquals(true, $config->isDebug());
     $this->assertInstanceOf('\\League\\Container\\Container', $config->getContainer());
     $this->assertInstanceOf('\\League\\Route\\RouteCollection', $config->getRouter());
     $this->assertInstanceOf('\\League\\Event\\Emitter', $config->getEventEmitter());
     $this->assertInstanceOf('\\Phprest\\Service\\Hateoas\\Config', $config->getHateoasConfig());
     $this->assertInstanceOf('\\Phprest\\Service\\Hateoas\\Service', $config->getHateoasService());
     $this->assertInstanceOf('\\League\\BooBoo\\Runner', $config->getErrorHandler());
     $this->assertInstanceOf('\\Phprest\\ErrorHandler\\Handler\\Log', $config->getLogHandler());
 }
コード例 #2
0
ファイル: Application.php プロジェクト: phprest/phprest
 /**
  * @param Config $configuration
  */
 public function __construct(Config $configuration)
 {
     $this->configuration = $configuration;
     $this->container = $configuration->getContainer();
     $this->router = $configuration->getRouter();
     $this->emitter = $configuration->getEventEmitter();
     AnnotationRegistry::registerLoader('class_exists');
     $this->registerService($configuration->getHateoasService(), $configuration->getHateoasConfig());
     $this->registerService($configuration->getLoggerService(), $configuration->getLoggerConfig());
     $this->setErrorHandler();
     $this->container->add(self::CONTAINER_ID_VENDOR, $configuration->getVendor());
     $this->container->add(self::CONTAINER_ID_API_VERSION, $configuration->getApiVersion());
     $this->container->add(self::CONTAINER_ID_DEBUG, $configuration->isDebug());
     $this->container->add(self::CONTAINER_ID_ROUTER, function () {
         return $this->router;
     });
     $this->stackBuilder = new Stack\Builder();
 }