15 return $this->explore(
17 ['with_genres' => substr($slug, strrpos($slug, '-') + 1)],
19 substr($slug, 0, strrpos($slug, '-'))
24 public function language($type, $language)
26 $code = substr($language, strrpos($language, '-') + 1);
28 return $this->explore(
30 ['with_original_language' => Str::lowercase($code) != 'en' ? $code : null],
32 substr($language, 0, strrpos($language, '-'))
37 public function country($type, $country)
39 $code = substr($country, strrpos($country, '-') + 1);
15 return $this->explore(
17 ['with_genres' => substr($slug, strrpos($slug, '-') + 1)],
19 substr($slug, 0, strrpos($slug, '-'))
24 public function language($type, $language)
26 $code = substr($language, strrpos($language, '-') + 1);
28 return $this->explore(
30 ['with_original_language' => Str::lowercase($code) != 'en' ? $code : null],
32 substr($language, 0, strrpos($language, '-'))
37 public function country($type, $country)
39 $code = substr($country, strrpos($country, '-') + 1);
68 (is_string($callback) && function_exists($callback))
69 || (is_object($callback) && ($callback instanceof Closure))
71 || (is_array($callback) && method_exists($callback[0], $callback[1]));
74 public static function load($callback, ...$params)
76 if (!self::exists($callback)) {
77 throw new UndefinedMethod((is_array($callback) ? (!is_string($callback[0]) ? get_class($callback[0]) : (string) $callback[0]) . '->' . $callback[1] : $callback) . '() does not exists');
80 return call_user_func($callback, ...array_values($params));
83 public static function create(string $class, ...$args)
85 if (!class_exists($class)) {
86 throw new UndefinedClass('Class: ' . $class . ' does not exists');
89 return new $class(...array_values($args));
92 public static function name($callback): string
107 // set new callback method
108 $route->setCallback([$route->getCallback()[0], $call_method]);
111 // escape grouped/nested named parameter
112 $route->setParameters($this->escapeNestedParameters($route->getParameters()));
114 // trigger route middleware event
115 $this->triggerEvent(IRoute::EVENTS['callback'], $route);
117 // load router callback
118 return CallbackHandler::load(
119 $route->getCallback(),
120 ...CallbackHandler::reflect(
121 $route->getParameters(),
122 $route->getCallback(),
123 array_merge($this->getReflectionParameters(), [$route])
128 public function callMiddlewares($middlewares): void
130 foreach ((array) $middlewares as $middleware) {
131 $class = CallbackHandler::create($middleware);
90 // utilize method required paramiters
91 $route->setParameters(
92 $this->applyFilters(self::FILTER['parameters'], $this->utilizeRouteParam($matches, $route))
98 // create route dispatcher
99 $dispatcher = new RouteDispatcher($this);
101 // dispatch route callback
102 return $dispatcher->dispatch($route);
107 if (isset($this->fallback) && CallbackHandler::exists($this->fallback)) {
108 CallbackHandler::load($this->fallback);
111 // not found any route for this path
112 throw new NotFoundException('the route does not matched..');
97 public static function run(): void
99 // load application initial kernels
100 self::$app->loadKernels('boot');
102 // render router result
103 echo self::$app->router->resolve();
105 // load application initial kernels
106 self::$app->loadKernels('shutdown');
110 * Check Anu Component added to the Application
114 public static function hasComponent(string $key): bool
116 return isset(self::$app->components[$key]);
14 'tmp_dir' => config('app.tmp_dir'),
15 'except' => ['/admin/*', '/embed/*', '/search/*'],
18 // serve from cache if production mode
23 // create a new application instance for this http request
24 Application::create(__DIR__)
25 ->registerKernel(App\Http\Kernels\AppKernel::class)
28 // stop the application execution process