src/Middlewares/DI/MiddlewaresPlugin.php
/**
	 * Register services (middlewares wrappers)
	 */
Register services (middlewares wrappers)
Register services ( middlewares wrappers )
public function loadPluginConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$globalConfig = $this->compiler->getExtension()->getConfig();
		$config = $this->config;
		if ($config->tracy) {
			$builder->addDefinition($this->prefix('tracy'))
				->setFactory(TracyMiddleware::class . '::factory', [$globalConfig->debug])
				->addTag(MiddlewaresExtension::MIDDLEWARE_TAG, ['priority' => 100]);
		}
		if ($config->autobasepath) {
			$builder->addDefinition($this->prefix('autobasepath'))
				->setFactory(AutoBasePathMiddleware::class)
				->addTag(MiddlewaresExtension::MIDDLEWARE_TAG, ['priority' => 200]);
		}
		$builder->addDefinition($this->prefix('api'))
			->setFactory(ApiMiddleware::class)
			->addTag(MiddlewaresExtension::MIDDLEWARE_TAG, ['priority' => 500]);
	}
public function loadPluginConfiguration ( ) : void { $ builder = $ this -> getContainerBuilder ( ) ; $ globalConfig = $ this -> compiler -> getExtension ( ) -> getConfig ( ) ; $ config = $ this -> config ; if ( $ config -> tracy ) { $ builder -> addDefinition ( $ this -> prefix ( 'tracy' ) ) -> setFactory ( TracyMiddleware :: class . '::factory' , [ $ globalConfig -> debug ] ) -> addTag ( MiddlewaresExtension :: MIDDLEWARE_TAG , [ 'priority' => 100 ] ) ; } if ( $ config -> autobasepath ) { $ builder -> addDefinition ( $ this -> prefix ( 'autobasepath' ) ) -> setFactory ( AutoBasePathMiddleware :: class ) -> addTag ( MiddlewaresExtension :: MIDDLEWARE_TAG , [ 'priority' => 200 ] ) ; } $ builder -> addDefinition ( $ this -> prefix ( 'api' ) ) -> setFactory ( ApiMiddleware :: class ) -> addTag ( MiddlewaresExtension :: MIDDLEWARE_TAG , [ 'priority' => 500 ] ) ; }
Register services (middlewares wrappers)
Register services ( middlewares wrappers )