static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->share(DocumentContext::class)->share(MacrosService::class)->share(MatisseSettings::class)->alias(DataBinderInterface::class, DataBinder::class)->prepare(ViewServiceInterface::class, function (ViewServiceInterface $viewService) {
             $viewService->register(MatisseEngine::class, '/\\.html$/');
         });
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->share(TasksSettings::class);
     })->onConfigure(function (ConsoleSettings $consoleSettings) {
         $consoleSettings->registerTasksFromClass(CoreTasks::class);
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->share(UserInterface::class, 'user')->share(AuthenticationSettings::class)->delegate(UserInterface::class, function (AuthenticationSettings $settings) use($injector) {
             return $injector->make($settings->userModel());
         });
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->share(WebServer::class)->alias(MiddlewareAssemblerInterface::class, DefaultMiddlewareAssembler::class);
     })->onConfigure(function (WebServer $webServer) {
         $webServer->setup();
     })->onRun(function (WebServer $webServer) {
         $webServer->run();
     });
 }
Beispiel #5
0
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->share(LoginSettings::class);
     })->onConfigure(function (LocalizationSettings $localizationSettings, ViewEngineSettings $viewEngineSettings, ApplicationRouterInterface $applicationRouter) use($moduleInfo) {
         $localizationSettings->registerTranslations($moduleInfo);
         $viewEngineSettings->registerViews($moduleInfo);
         $applicationRouter->add(self::class, 'login', 'platform');
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->share(LocalizationSettings::class)->share(new Locale(), 'locale');
     })->onConfigure(function (LocalizationSettings $settings) {
         if ($tz = $settings->timeZone()) {
             date_default_timezone_set($tz);
         }
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) use($kernel) {
         $injector->alias(ViewInterface::class, View::class)->alias(ViewServiceInterface::class, ViewService::class)->share(ViewServiceInterface::class)->prepare(ViewServiceInterface::class, function (ViewServiceInterface $viewService) {
             // No default view engines are available at this time.
         })->share(AssetsService::class)->share(BlocksService::class)->share(ViewEngineSettings::class)->delegate(TemplateCache::class, function (ViewEngineSettings $settings) use($injector, $kernel) {
             return new TemplateCache($injector->make(FileSystemCache::class), $settings->caching(), $kernel->devEnv());
         })->share(TemplateCache::class);
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->alias(ErrorRendererInterface::class, ErrorRenderer::class)->share(ErrorHandlingSettings::class);
     });
     if ($kernel->devEnv()) {
         $kernel->onConfigure(function (ApplicationMiddlewareInterface $applicationMiddleware) {
             $applicationMiddleware->add(EditorLauncherMiddleware::class, null, 'router');
         });
     }
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->delegate(ConnectionInterface::class, function ($webConsole) {
             return $webConsole ? new DebugConnection() : new Connection();
         })->share(ConnectionsInterface::class)->delegate(ConnectionsInterface::class, function ($webConsole) {
             $connections = new Connections();
             $connections->setConnectionClass($webConsole ? DebugConnection::class : Connection::class);
             return $connections;
         })->alias(ModelControllerInterface::class, ModelController::class)->share(ModelController::class);
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->delegate(Server::class, function (ResponseFactoryInterface $responseFactory, ContentServerSettings $settings) {
             return ServerFactory::create(['source' => $settings->fileArchivePath(), 'cache' => $settings->imagesCachePath(), 'response' => new PsrResponseFactory($responseFactory->makeStream(), function ($stream) use($responseFactory) {
                 return $responseFactory->makeBody('', $stream);
             })]);
         })->share(Server::class)->delegate(ContentRepositoryInterface::class, function (ContentServerSettings $settings) {
             $urlBuilder = UrlBuilderFactory::create($settings->fileBaseUrl());
             return new ContentRepository($urlBuilder);
         })->share(ContentRepositoryInterface::class)->share(ContentServerSettings::class);
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->alias(NavigationInterface::class, Navigation::class)->share(NavigationInterface::class, 'navigation')->alias(NavigationLinkInterface::class, NavigationLink::class)->share(NavigationSettings::class);
     })->onReconfigure(function (InjectorInterface $injector, NavigationSettings $settings, NavigationInterface $navigation) {
         foreach ($settings->getProviders() as $provider) {
             if (is_string($provider)) {
                 $provider = $injector->make($provider);
             }
             $provider->defineNavigation($navigation);
         }
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->execute(function ($webConsole) use($injector) {
             $injector->alias(RouterInterface::class, $webConsole ? RouterWithLogging::class : Router::class)->alias(MiddlewareStackInterface::class, $webConsole ? MiddlewareStackWithLogging::class : MiddlewareStack::class)->alias(RouteMatcherInterface::class, RouteMatcher::class)->share(ApplicationRouterInterface::class)->alias(ApplicationRouterInterface::class, RoutingMiddleware::class)->share(ApplicationMiddlewareInterface::class)->delegate(ApplicationMiddlewareInterface::class, function (MiddlewareAssemblerInterface $assembler, MiddlewareStackInterface $stack) {
                 $assembler->assemble($stack);
                 return $stack;
             })->share(CurrentRequestMutator::class);
             if ($webConsole) {
                 $injector->share(RoutingLogger::class);
             }
         });
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->share(PlatformSettings::class);
     })->onConfigure(function (MatisseSettings $matisseSettings, AuthenticationSettings $authSettings, ApplicationMiddlewareInterface $middleware, LocalizationSettings $localizationSettings, NavigationSettings $navigationSettings, ViewEngineSettings $viewEngineSettings) use($moduleInfo) {
         $localizationSettings->registerTranslations($moduleInfo);
         $navigationSettings->registerNavigation(Navigation::class);
         $authSettings->userModel(UserModel::class);
         $viewEngineSettings->registerViews($moduleInfo);
         $matisseSettings->registerMacros($moduleInfo)->registerPresets([Config\PlatformPresets::class])->registerComponents(['LanguageSelector' => LanguageSelector::class])->registerControllersNamespace($moduleInfo, \Selenia\Platform\Components::class, 'platform');
         $middleware->add(AutoRoutingMiddleware::class, null, null, 'router');
     })->onReconfigure(function (ApplicationRouterInterface $router) {
         $router->add(Routes::class, 'platform');
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->share(ConsoleSettings::class)->alias(ConsoleIOInterface::class, ConsoleIO::class)->share(ConsoleIO::class)->delegate(SymfonyConsole::class, function () {
             return new SymfonyConsole("\nWorkman Task Runner");
         })->share(SymfonyConsole::class)->share(ConsoleApplication::class);
     })->onRun(function (ConsoleApplication $consoleApp) use($kernel) {
         // If no code on the startup process has set the console instance's input/output, set it now.
         if (!$consoleApp->getIO()->getInput()) {
             $consoleApp->setupStandardIO($_SERVER['argv']);
         }
         // Run the framework's console subsystem, which then runs the terminal-based application.
         $kernel->setExitCode($consoleApp->execute());
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->share(DatabaseAPI::class)->prepare(DatabaseAPI::class, function (DatabaseAPI $db) {
             $db->manager->setAsGlobal();
             $db->manager->setEventDispatcher(new Dispatcher($db->manager->getContainer()));
             $db->manager->bootEloquent();
             Model::setConnectionResolver($db);
         })->alias(ModelControllerInterface::class, ModelController::class)->share(ModelController::class)->share(MigrationsSettings::class)->alias(MigrationsInterface::class, Migrations::class);
     });
     if ($kernel->getProfile() instanceof ConsoleProfile) {
         $kernel->onConfigure(function (ConsoleSettings $consoleSettings) {
             $consoleSettings->registerTasksFromClass(MigrationCommands::class);
         });
     }
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->delegate(Swift_Mailer::class, function () use($injector) {
             $transport = new \Swift_SmtpTransport(env('EMAIL_SMTP_HOST', 'localhost'), env('EMAIL_SMTP_PORT', 25));
             if (env('EMAIL_SMTP_AUTH')) {
                 $transport->setUsername(env('EMAIL_SMTP_USERNAME'))->setPassword(env('EMAIL_SMTP_PASSWORD'));
             }
             $mailer = new Swift_Mailer($transport);
             $logger = new Swift_Plugins_Loggers_ArrayLogger(self::MAX_LOG_SIZE);
             $mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));
             // Create run-time custom property to allow easy access to the logger.
             $mailer->logger = $logger;
             return $mailer;
         });
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->alias(SessionInterface::class, Session::class)->share(Session::class, 'session');
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         $injector->alias(RedirectionInterface::class, Redirection::class)->alias(ResponseFactoryInterface::class, ResponseFactory::class)->alias(ResponseSenderInterface::class, ResponseSender::class)->alias(ServerRequestInterface::class, ServerRequest::class)->alias(ResponseInterface::class, Response::class);
     });
 }
 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onRegisterServices(function (InjectorInterface $injector) {
         //        $injector->alias(CacheLoggerInterface::class, LoggerInterface::class);
     });
 }