Binds the Passport routes into the controller.

@param  callable|null  $callback
@param  array  $options
@return void
16995
public static function routes($callback = null, array $options = [])
    {
        $callback = $callback ?: function ($router) {
            $router->all();
        };

        $defaultOptions = [
            'prefix' => 'oauth',
            'namespace' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers',
        ];

        $options = array_merge($defaultOptions, $options);

        Route::group($options, function ($router) use ($callback) {
            $callback(new RouteRegistrar($router));
        });
    }
1211413
public function route(array $method, $uri, $callback, $options = [])
    {
        if (is_array($uri)) {
            foreach ($uri as $u) {
                $this->route($method, $u, $callback, $options);

            }
            return $this;
        }
        $options = array_merge(['ajaxOnly' => false, 'continue' => false], (array)$options);

        if ($uri != '/') {
            $uri = $this->removeDuplSlash($uri) . '/';
        }
        // Replace named uri param to regex pattern.
        $pattern = $this->namedParameters($uri);
        $this->currentUri = $pattern;

        if ($options['ajaxOnly'] == false || $options['ajaxOnly'] && $this->req->ajax) {
            // If matched before, skip this.
            if ($this->matched === false) {
                // Prepare.
                $pattern = $this->prepare(
                    str_replace(['/?', '/*'], [$this->pattern['/?'], $this->pattern['/*']], $this->removeDuplSlash($this->group . $pattern))
                );

                // If matched.
                $method = count($method) > 0 ? in_array($this->req->method, $method) : true;
                if ($method && $this->matched($pattern)) {
                    if ($this->isGroup) {
                        $this->prams = array_merge($this->pramsGroup, $this->prams);
                    }

                    $this->req->args = $this->bindArgs($this->prams, $this->matchedArgs);

                    $this->matchedPath = $this->currentUri;
                    $this->routeCallback[] = $callback;

                    if ($options['continue']) {
                        $this->matched = false;
                    }
                }
            }
        }
        $this->_as($this->removeParameters($this->trimSlash($uri)));
        return $this;
    }
1234339
public function addRoute(string $method, string $route, ...$callback)
    {
        $method = strtolower($method);
        $route = ltrim($route, '/');
        $group = rtrim($this->group, '/') . '/';
        $route = $group . $route;
        $scope = $this->middleware->count();
        $this->layer[$method][] = new Route(
            $method,
            $route,
            $callback,
            $scope,
            $this->group
        );

        return true;
    }
770650
public function bind($path, $callback, $condition = true) {

        if (!$condition) return;

        if (!isset($this->routes[$path])) {
            $this->routes[$path] = [];
        }

        // make $this available in closures
        if (\is_object($callback) && $callback instanceof \Closure) {
            $callback = $callback->bindTo($this, $this);
        }

        // autou-register for /route/* also /route
        if (\substr($path, -2) == '/*' && !isset($this->routes[\substr($path, 0, -2)])) {
            $this->bind(\substr($path, 0, -2), $callback, $condition);
        }

        $this->routes[$path] = $callback;
    }
140241
public function map(array $verbs, string $uri, $callback): Route
    {
        if ($this->isControllerString($callback)) {
            $callback = $this->normaliseCallbackString($callback);
        }

        return parent::map($verbs, $uri, $callback);
    }
63732
public static function withLanguage(\Closure $callback, $config = [])
    {
        if (\App::runningUnitTests()) {
            $locale = \App::getLocale();
        } else {
            $locale = request()->segment(1);
        }

        if (strlen($locale) <= 2) {
            Route::group(['prefix' => $locale, 'middleware' => 'lang'], function () use ($callback) {
                $callback();
            });
        }
    }
446012
public function options(String $path, Callable $callback) : Route {

		return $this->collectRoute('OPTIONS', $path, $callback);

	}
880881
public static function options( $route = null, $callback = null ) {
		// Make sure that our parameters are what they say they are
		$args = self::smart_parameters( func_get_args() );

		return self::route( 'OPTIONS', $args[ 'route' ], $args[ 'callback' ] );
	}
309497
public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0)
    {
        respondWith(response()->jsonp($callback, $data, $status, $headers, $options));
    }
669605
public static function syncRoutes(Connection $connection, array $routes, \Closure $callback)
    {
        $scopes = [];
        $maxId  = (int) $connection->fetchColumn('SELECT MAX(id) AS max_id FROM fusio_routes');

        foreach ($routes as $row) {
            $route = $connection->fetchAssoc('SELECT id, status, priority, methods, controller FROM fusio_routes WHERE path = :path', [
                'path' => $row['path']
            ]);

            if (empty($route)) {
                // the route does not exist so create it
                self::insertRow('fusio_routes', $row, $callback);

                $maxId++;

                $scopeId = NewInstallation::getScopeIdFromPath($row['path']);
                if ($scopeId !== null) {
                    $scopes[] = [
                        'scope_id' => $scopeId,
                        'route_id' => $maxId,
                        'allow'    => 1,
                        'methods'  => 'GET|POST|PUT|PATCH|DELETE',
                    ];
                }
            } else {
                // the route exists check whether something has changed
                $columns = ['status', 'priority', 'controller'];

                self::updateRow('fusio_routes', $row, $route, $columns, $callback);
            }
        }

        if (!empty($scopes)) {
            // add new routes to scopes
            foreach ($scopes as $row) {
                self::insertRow('fusio_scope_routes', $row, $callback);
            }
        }
    }
229490
public function call($callback, array $parameters = [])
    {
        $this->_events[] = $event = new CallbackEvent($callback, $parameters);

        return $event;
    }
207364
function redirect($to, $options = [])
    {
        return function(\Silex\Application $app) use ($to, $options) {
            $headers  = (array) @$options['headers'];
            $status   = @$options['status'] ?: 302;
            $params   = (array) @$options['params'];
            $absolute = @$options['absolute'] ?: false;

            # Generate URL if the first argument is an existing route name
            if ($route = $app['routes']->get($to)) {
                $to = $app['url_generator']->generate($to, $params, $absolute);
            }

            return new RedirectResponse($to, $status, $headers);
        };
    }
242849
public function bind( $key, $callback ){
		if( is_callable( $callback ) )
			$callback	= new ADT_Event_Callback( $callback );
		if( !( $callback instanceof ADT_Event_Callback ) )
			throw new InvalidArgumentException( 'Callback must be function or instance of ADT_Event_Callback' );
		if( !is_array( $list = $this->events->get( $key ) ) )
			$list	= array();
		$list[]	= array( $key, $callback );
		$this->events->set( $key, $list );
	}
399270
protected function initTransaction(array $options = [])
    {
        if (!isset($options['transactionId'])) {
            $this->transactionId = IdGenerator::generateId();
            $this->getClient()->sendFrame(
                $this->getProtocol()->getBeginFrame($this->transactionId)
            );
        } else {
            $this->transactionId = $options['transactionId'];
        }
    }
120768
protected function addTwigFilter($name, $callback, $options = [])
    {
        // If we pass a callback as a simple string, we need to turn it into an array.
        if (is_string($callback) && method_exists($this, $callback)) {
            $callback = [$this, $callback];
        }

        $safe = method_exists($this, 'isSafe') && $this->isSafe();
        if (isset($options['safe'])) {
            $safe = (bool) $options['safe'];
            unset($options['safe']);
        }

        $this->twigFilters[] = new TwigFilter($name, $callback, $options);

        if ($safe) {
            $this->safeFilterNames[] = $name;
        }
    }
884849
public function bind($eventName, $callback, $mode = EventsHandlerInterface::BINDING_MODE_LAST)
    {
        if ($eventsHandler = $this->getEventsHandler()) {
            $eventsHandler->bind($eventName, $callback, $mode);
        }
    }
485864
public function page($route, $callback) {
        if ($this->configFunction != null) {
            $function = $this->configFunction;
            $result = $function();

            if ($result === false) {
                return;
            }
        }

        $crud = $this;
        
        $this->getSlim()->get($route, function () use ($crud, $callback) {
            $content = $callback();
            
            $this->render($this->getPageLayout(), [
                "content" => $content
            ], true);
        });
    }