@param Container $app

@return \Ray\Aop\Pointcut
506747
public function configure(Container $app): Pointcut
    {
        $interceptor = new TransactionalInterceptor;
        $interceptor->setDatabaseManager($app['Illuminate\Database\DatabaseManager']);
        $this->setInterceptor($interceptor);

        return $this->withAnnotatedAnyInterceptor();
    }
21844
public function register(Container $app)
    {
        $app["cache.service"] = function(Container $app) {
            $handlerClass = ucfirst($app["config.service"]["cache.handler"]);

            return new \SlaxWeb\Cache\Manager(
                $app["cache{$handlerClass}Handler.service"]
            );
        };

        $app["cacheFileHandler.service"] = function(Container $app) {
            return new \SlaxWeb\Cache\Handler\File(
                $app["config.service"]["cache.location"],
                $app["config.service"]["cache.maxAge"]
            );
        };
    }
840014
public function register(Container $app)
    {
        $app["serializer.namingStrategy"] = "CamelCase";
        $app["serializer.namingStrategy.separator"] = "_";
        $app["serializer.namingStrategy.lowerCase"] = true;

        $app["serializer.propertyNamingStrategy"] = new PropertyNamingStrategyService();
        $app["serializer.builder"] = new BuilderService();
        $app["serializer"] = function (Container $app) {
            return $app["serializer.builder"]->build();
        };
    }
1273730
private function loadMiddlewares($app, $container)
    {
        # Tracy debugbar
        $debugbar_enabled = filter_var(app_env('DEBUG_BAR_ON', false), FILTER_VALIDATE_BOOLEAN);
        if (is_dev() && $debugbar_enabled && PHP_SAPI !== "cli")
        {
            $app->add(new TracyMiddleware($app));
        }

        # Determine Route Before Application middleware
        $app->add(new AppMiddleware($container));

        # Global Error middleware
        $app->add(new GlobalErrorsMiddleware($container));

        # Old Input middleware
        $app->add(new OldInputMiddleware($container));

        # Global Csrf middleware
        $app->add(new GlobalCsrfMiddleware($container));
        $app->add($container->get('csrf'));

        # Shared Server middleware
        $app->add(new SharedServerMiddleware($container));

        # Application Mode middleware
        $app->add(new AppModeMiddleware($container));

        # Remove Trailing Slash middleware
        $app->add(new RemoveTrailingSlashMiddleware($container));
    }
673866
public function register(Container $app): void
    {
        $app['markdown'] = function () {
            return Parsedown::instance();
        };

        $partialsCollection = new Collection();
        $app['partials'] = $partialsCollection;

        /** @var Partial[] $partials */
        $partials = []; //$config->getPartials();
        if ($partials) {
            foreach ($partials as $partial) {
                if (! $partial->getName()) {
                    throw new MissingNameForPartialException('The name of the partial to load is missing');
                }

                $partial->setParser($app['markdown']);
                if (!$partial->getContent() && $partial->getLink()) {
                    if (! is_readable($partial->getLink())) {
                        $app['monolog']->error(
                            sprintf('Partial "%s" not readable or found.', $partial->getLink())
                        );
                        continue;
                    }
                }

                $partialsCollection->set($partial->getName(), $partial);
            }
        }
    }
106098
public function handle(Container $app, Sandbox $sandbox)
    {
        if ($sandbox->isLaravel()) {
            $kernel = $app->make(Kernel::class);

            $closure = function () use ($app) {
                $this->app = $app;
            };

            $resetKernel = $closure->bindTo($kernel, $kernel);
            $resetKernel();
        }

        return $app;
    }
279121
public static function medusa($app, $dir = __DIR__)
  {
    $medusa = new $app->view();

    $root = $app->config['app']['dir'];

    $views          = $dir . DIRECTORY_SEPARATOR . '..' .DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR;
    $viewsDirectory = $dir . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR;

    if (Filesystem::isDirectory($views)) {
      $views = $views;
    } else if ($viewsDirectory) {
      $views = $viewsDirectory;
    }

    $medusa->setCacheDirectory($root . $app->config['view']['compiled']);
    $medusa->setViewsDirectory($views);
    $medusa->setViewsExtension($app->config['view']['extension']);

    Self::$view = $medusa;
  }
1105719
public function setApplication($app)
    {
        Argument::i()->test(1, 'string');

        $this->application = $app;
        return $this->setData($this->message);
    }
312065
public function register(Container $app)
    {
        $routerContainer = new RouterContainer();
        $app[Map::class] = $routerContainer->getMap();
        $app[RuleIterator::class] = $routerContainer->getRuleIterator();
    }
707521
public function app($app)
    {
        $this->classRoute = Router::$defaultNameSpace . $app;
        
        $request = Router::$requestDriver;
        if (!empty($request)) {
            if (!$request->query->get("q")) {
                $request->query->set("q", "/");
            }
        } else {
            $_GET['q'] = "/";
        }
        
        if ($this->method === "ALL" ||
            ((!empty($request) && $this->method === $request->server->get("REQUEST_METHOD")) ||
                $_SERVER['REQUEST_METHOD'] === $this->method)
        ) {
            $this->useRoute($this->route);
        } else {
            $this->classRoute = false;
        }
        
        return new RouteMiddleware($this->route, $this->classRoute, $this->methodRoute);
    }
234981
public function bootstrap(Application $app)
	{
		try
		{
			Dotenv::load($app->basePath(), $app->environmentFile());
		}
		catch (InvalidArgumentException $e)
		{
			//
		}

		$app->detectEnvironment(function()
		{
			return env('APP_ENV', 'production');
		});
	}
537656
public function register(Container $app)
    {
        $app["slaxer.service"] = function (Container $app) {
            $cliApp = new CLIApp("Slaxer", "0.4.*-dev");

            if (isset($app["slaxerCommands"]) === false) {
                return $cliApp;
            }

            foreach ($app["slaxerCommands"] as $key => $value) {
                $params = [];
                if (is_int($key)) {
                    $command = $value;
                } else {
                    $command = $key;
                    if (is_string($value)) {
                        $value = [$value];
                    }
                    foreach ($value as $service) {
                        $params[] = $app[$service];
                    }
                }

                $cmd = new $command($app["logger.service"]("Slaxer"));
                if (method_exists($cmd, "init")) {
                    $cmd->init(...$params);
                }
                $cliApp->add($cmd);
            }

            return $cliApp;
        };
    }
517076
public function bindIlluminateCore(Container $app = null)
    {
        if (! $app) {
            $app = new Container();
        }

        $this->ensureIlluminateBase($app);

        // Core classes
        $app->bindIf('url', $this->illuminateClasses[ 'url' ]);

        // Session and request
        $app->bindIf('session.manager', function ($app) {
            return new SessionManager($app);
        });

        $app->bindIf('session', function ($app) {
            return $app['session.manager']->driver('array');
        }, true);

        $app->bindIf('request', function ($app) {
            $request = Request::createFromGlobals();

            if (method_exists($request, 'setSessionStore')) {
                $request->setSessionStore($app['session']);
            } else {
                $request->setSession($app['session']);
            }

            return $request;
        }, true);

        // Config
        $app->bindIf('path.config', function ($app) {
            return $this->illuminateConfigPath;
        }, true);

        $app->bindIf('config', function ($app) {
            $config = new Repository;
            $this->loadIlluminateConfig($app, $config);

            return $config;
        }, true);

        // Localization
        $app->bindIf('translation.loader', function ($app) {
            return new FileLoader($app['files'], 'src/config');
        });

        $app->bindIf('translator', function ($app) {
            $loader = new FileLoader($app['files'], 'lang');

            return new Translator($loader, 'en');
        });

        return $app;
    }
1147240
public function bootstrap(Application $app)
    {
        try
        {
            Dotenv::makeMutable();
            Dotenv::load($app->environmentPath(), $app->environmentFile());
            Dotenv::makeImmutable();
        } catch (InvalidArgumentException $e)
        {
            //
        }

        $app->detectEnvironment(
            function ()
            {
                return env('APP_ENV', 'production');
            }
        );
    }
1019359
public static final function create(App $app): ?Service
    {
        $request = $app->request();
        $response = $app->response();
        $requestUri = $request->uri();
        $requestMethod = $request->method();

        // detect service name if provided
        $service = null;
        $serviceName = strtolower($requestUri->segment(1, ''));
        $serviceNameAlias = '';
        $serviceMethod = null;
        $serviceMethodFilter = null;
        $serviceMethodArguments = null;
        $serviceAliases = $app->configValue('service.aliases');

        // main
        if ($serviceName == '') {
            $serviceName = Service::SERVICE_MAIN;
        }
        // aliases
        elseif (isset($serviceAliases[$serviceName][0])) {
            $serviceNameAlias = $serviceName;
            // 0 => name, methods => ...
            $serviceName = $serviceAliases[$serviceNameAlias][0];
            // 0 => name, method => ... if given for one invoke direction
            $serviceMethod = $serviceAliases[$serviceNameAlias]['method'] ?? null;
            // 0 => name, method => ..., methodFilter => ... if given for one invoke direction filter
            $serviceMethodFilter = $serviceAliases[$serviceNameAlias]['methodFilter'] ?? null;
        }
        // regexp routes
        else if (isset($serviceAliases['~~'])) {
            $uriPath = $requestUri->getPath();
            foreach ((array) $serviceAliases['~~'] as $route) {
                // these are required
                if (empty($route['method']) || empty($route['pattern'])) {
                    throw new ServiceException("Both 'method' and 'pattern' are required for RegExp aliases");
                }

                if (preg_match($route['pattern'], $uriPath, $match)) {
                    $serviceName = $route[0];
                    $serviceMethod = $route['method'];
                    $serviceMethodFilter = $route['methodFilter'] ?? null;
                    $serviceMethodArguments = array_slice($match, 1);
                    break;
                }
            }
        }

        $serviceName = self::toServiceName($serviceName);
        $serviceFile = self::toServiceFile($serviceName);
        $serviceClass = self::toServiceClass($serviceName);

        // set service as FailService
        if (!self::isServiceExists($serviceFile, $serviceClass)) {
            set_global('app.service.fail', [
                'code' => 404,
                'text' => sprintf('Service not found [%s]', $serviceName),
            ]);

            // set response status
            $response->setStatus(404);

            $serviceName   = Service::SERVICE_FAIL . Service::SERVICE_NAME_SUFFIX;
            $serviceMethod = Service::METHOD_MAIN;
            $serviceFile   = self::toServiceFile($serviceName);
            $serviceClass  = self::toServiceClass($serviceName);
        }

        $service = new $serviceClass($app, $serviceName, $serviceMethod);

        // detect and set service method
        if (!$service->isFailService()) {
            if ($serviceMethod != '') { // pass
                // @note: method could be checked in main() [if $useMainOnly=true in service]
                // @note: this will override $useMainOnly option in service
            } elseif ($service->usesMainOnly()) {
                // main only
                $serviceMethod = Service::METHOD_MAIN;
            } elseif ($service->isSite()) {
                // from segment
                if ($serviceMethod == '') {
                    $serviceMethod = strtolower($requestUri->segment(2, ''));
                }

                // alias
                if (isset($serviceAliases[$serviceNameAlias]['methods'][$serviceMethod])) {
                    $serviceMethod = self::toServiceMethod($serviceAliases[$serviceNameAlias]['methods'][$serviceMethod]);
                } elseif ($serviceMethod == '' || $serviceMethod == Service::METHOD_MAIN) {
                    // main
                    $serviceMethod = Service::METHOD_MAIN;
                } else {
                    $serviceMethod = self::toServiceMethod($serviceMethod);
                }
            } elseif ($service->isRest()) {
                // from request method
                $serviceMethod = strtolower($requestMethod->getName());
            }

            // check method
            if (!self::isServiceMethodExists($service, $serviceMethod)) {
                // check fallback method
                if (self::isServiceFallMethodExists($service)) {
                    $serviceMethod = Service::METHOD_FALL;
                } else {
                    set_global('app.service.fail', [
                        'code' => 404,
                        'text' => sprintf('Service method not found [%s::%s()]', $serviceName, $serviceMethod)
                    ]);

                    // set response status
                    $response->setStatus(404);

                    // override
                    $serviceName   = Service::SERVICE_FAIL . Service::SERVICE_NAME_SUFFIX;
                    $serviceMethod = Service::METHOD_MAIN;
                    $serviceFile   = self::toServiceFile($serviceName);
                    $serviceClass  = self::toServiceClass($serviceName);

                    // re-create service as FailService
                    $service = new $serviceClass($app, $serviceName, $serviceMethod);
                }
            }

            $service->setMethod($serviceMethod);

            // set service method arguments
            if (self::isServiceMethodExists($service, $serviceMethod)) {
                $serviceMethodArguments = isset($serviceMethodArguments) ? $serviceMethodArguments
                    : $requestUri->segmentArguments($service->isSite() ? 2 : 1);

                $ref = new \ReflectionMethod($serviceClass, $serviceMethod);
                foreach ($ref->getParameters() as $i => $param) {
                    if (!isset($serviceMethodArguments[$i])) {
                        $serviceMethodArguments[$i] = $param->isDefaultValueAvailable()
                            ? $param->getDefaultValue() : null;
                    }
                }

                $service->setMethodArguments($serviceMethod, $serviceMethodArguments);

                // method filter
                if ($serviceMethodFilter != null) {
                    $serviceMethodFilter->call($service);
                }
            }
        }

        return $service;
    }
449935
public function bootstrap(Application $app)
	{
		$this->configureHandlers($app, $this->registerLogger($app));

		// Next, we will bind a Closure that resolves the PSR logger implementation
		// as this will grant us the ability to be interoperable with many other
		// libraries which are able to utilize the PSR standardized interface.
		$app->bind('Psr\Log\LoggerInterface', function($app)
		{
			return $app['log']->getMonolog();
		});
	}
692496
public function boot(Container $app)
    {
        $app->afterResolving(function (Factory $factory, $app) {

            $factory->addExtension('php', 'php', function () {
                return new PhpEngine();
            });

            $factory->addExtension('blade.php', 'blade', function () use ($app) {
                return new CompilerEngine($app->make(BladeCompiler::class));
            });

            $factory->addExtension('md', 'markdown', function () use ($app) {
                return new CompilerEngine($app->make(Markdown::class));
            });

        });

        $app->when(BladeCompiler::class)
            ->needs('$cachePath')
            ->give(vfsStream::setup('root/.blade')->url());
    }