src/Charcoal/App/App.php
private function setupRoutables()
    {
        $app = $this;
        // For now, need to rely on a catch-all...
        $this->get(
            '{catchall:.*}',
            function (
                RequestInterface $request,
                ResponseInterface $response,
                array $args
            ) use ($app) {
                $config = $app->config();
                $routables = $config['routables'];
                if ($routables === null || count($routables) === 0) {
                    return $this['notFoundHandler']($request, $response);
                }
                $routeFactory = $this['route/factory'];
                foreach ($routables as $routableType => $routableOptions) {
                    $route = $routeFactory->create($routableType, [
                        'path' => $args['catchall'],
                        'config' => $routableOptions
                    ]);
                    if ($route->pathResolvable($this)) {
                        $this['logger']->debug(
                            sprintf('Loaded routable "%s" for path %s', $routableType, $args['catchall'])
                        );
                        return $route($this, $request, $response);
                    }
                }

                // If this point is reached, no routable has provided a callback. 404.
                return $this['notFoundHandler']($request, $response);
            }
        );
    }
private function setupRoutables()
    {
        $app = $this;
        // For now, need to rely on a catch-all...
        $this->get(
            '{catchall:.*}',
            function (
                RequestInterface $request,
                ResponseInterface $response,
                array $args
            ) use ($app) {
                $config = $app->config();
                $routables = $config['routables'];
                if ($routables === null || count($routables) === 0) {
                    return $this['notFoundHandler']($request, $response);
                }
                $routeFactory = $this['route/factory'];
                foreach ($routables as $routableType => $routableOptions) {
                    $route = $routeFactory->create($routableType, [
                        'path' => $args['catchall'],
                        'config' => $routableOptions
                    ]);
                    if ($route->pathResolvable($this)) {
                        $this['logger']->debug(
                            sprintf('Loaded routable "%s" for path %s', $routableType, $args['catchall'])
                        );
                        return $route($this, $request, $response);
                    }
                }

                // If this point is reached, no routable has provided a callback. 404.
                return $this['notFoundHandler']($request, $response);
            }
        );
    }
private function setupRoutables ( ) { $ app = $ this ; // For now, need to rely on a catch-all... $ this -> get ( '{catchall:.*}' , function ( RequestInterface $ request , ResponseInterface $ response , array $ args ) use ( $ app ) { $ config = $ app -> config ( ) ; $ routables = $ config [ 'routables' ] ; if ( $ routables === null || count ( $ routables ) === 0 ) { return $ this [ 'notFoundHandler' ] ( $ request , $ response ) ; } $ routeFactory = $ this [ 'route/factory' ] ; foreach ( $ routables as $ routableType => $ routableOptions ) { $ route = $ routeFactory -> create ( $ routableType , [ 'path' => $ args [ 'catchall' ] , 'config' => $ routableOptions ] ) ; if ( $ route -> pathResolvable ( $ this ) ) { $ this [ 'logger' ] -> debug ( sprintf ( 'Loaded routable "%s" for path %s' , $ routableType , $ args [ 'catchall' ] ) ) ; return $ route ( $ this , $ request , $ response ) ; } } // If this point is reached, no routable has provided a callback. 404. return $ this [ 'notFoundHandler' ] ( $ request , $ response ) ; } ) ; }
Setup the application's "global" routables.

Routables can only be defined globally (app-level) for now.

@return void
Setup the application s global routables .