public function defaultCallable($arguments = array()): bool
    {
        $this->logger->log('Default callable called!');

        $controller = $arguments['controller'];
        $function = $arguments['function'];
        $parameters = empty($arguments['parameters']) ? null : $arguments['parameters'];

        // Construct file paths and classes
        $class = '\Application\Controller\\'.ucfirst($controller);
        $directory = $this->controller_directory;
        $file = $directory . DS . strtolower('controller.'.$controller.'.php');

        $event = Events::fireEvent('routerLoadControllerEvent', 
            $file, 
            $directory, 
            $class, 
            $controller, 
            $function, 
            $parameters
        );

        // Cancel if requested to do so
        if ($event->isCancelled()) {
            return false;
        }

        // Check if the file exists
        if (file_exists($event->file)) {
            if (!class_exists($event->className)) {
                $this->logger->log('Loading controller '.$event->className.' from file: '.$event->file);
                require $event->file;
            }

            // Get the path the controller should know about
            $path = implode('/', $this->uri->rsegments);

            // And create the controller
            $this->callable = new $event->className($path);

            // If the controller does not want a function to be loaded, provide a halt parameter.
            if (isset($this->callable->halt)) {
                return false;
            }

            // Check if method exists or if there is a caller function
            if (method_exists($this->callable, $event->function) || method_exists($this->callable, '__call')) {
                // Run the routerCallMethodEvent
                $methodEvent = Events::fireEvent('routerCallMethodEvent');
                if ($methodEvent->isCancelled())
                {
                    return false;
                }

                // Execute the function on the controller
                $this->output->append_output($this->callable->{$event->function}($event->parameters));
                return true;
            } else {
                // Function could not be found
                $this->logger->log('Could not find function '.$event->function.' on controller '.$event->className);
                $this->logger->http_error(404);
            }
        } else {
            // Controller could not be found
            $this->logger->log('Could not find controller '.$event->className);
            $this->logger->http_error(404);
        }

        return false;
    }
public function defaultCallable($arguments = array()): bool
    {
        $this->logger->log('Default callable called!');

        $controller = $arguments['controller'];
        $function = $arguments['function'];
        $parameters = empty($arguments['parameters']) ? null : $arguments['parameters'];

        // Construct file paths and classes
        $class = '\Application\Controller\\'.ucfirst($controller);
        $directory = $this->controller_directory;
        $file = $directory . DS . strtolower('controller.'.$controller.'.php');

        $event = Events::fireEvent('routerLoadControllerEvent', 
            $file, 
            $directory, 
            $class, 
            $controller, 
            $function, 
            $parameters
        );

        // Cancel if requested to do so
        if ($event->isCancelled()) {
            return false;
        }

        // Check if the file exists
        if (file_exists($event->file)) {
            if (!class_exists($event->className)) {
                $this->logger->log('Loading controller '.$event->className.' from file: '.$event->file);
                require $event->file;
            }

            // Get the path the controller should know about
            $path = implode('/', $this->uri->rsegments);

            // And create the controller
            $this->callable = new $event->className($path);

            // If the controller does not want a function to be loaded, provide a halt parameter.
            if (isset($this->callable->halt)) {
                return false;
            }

            // Check if method exists or if there is a caller function
            if (method_exists($this->callable, $event->function) || method_exists($this->callable, '__call')) {
                // Run the routerCallMethodEvent
                $methodEvent = Events::fireEvent('routerCallMethodEvent');
                if ($methodEvent->isCancelled())
                {
                    return false;
                }

                // Execute the function on the controller
                $this->output->append_output($this->callable->{$event->function}($event->parameters));
                return true;
            } else {
                // Function could not be found
                $this->logger->log('Could not find function '.$event->function.' on controller '.$event->className);
                $this->logger->http_error(404);
            }
        } else {
            // Controller could not be found
            $this->logger->log('Could not find controller '.$event->className);
            $this->logger->http_error(404);
        }

        return false;
    }
public function defaultCallable ( $ arguments = array ( ) ) : bool { $ this -> logger -> log ( 'Default callable called!' ) ; $ controller = $ arguments [ 'controller' ] ; $ function = $ arguments [ 'function' ] ; $ parameters = empty ( $ arguments [ 'parameters' ] ) ? null : $ arguments [ 'parameters' ] ; // Construct file paths and classes $ class = '\Application\Controller\\' . ucfirst ( $ controller ) ; $ directory = $ this -> controller_directory ; $ file = $ directory . DS . strtolower ( 'controller.' . $ controller . '.php' ) ; $ event = Events :: fireEvent ( 'routerLoadControllerEvent' , $ file , $ directory , $ class , $ controller , $ function , $ parameters ) ; // Cancel if requested to do so if ( $ event -> isCancelled ( ) ) { return false ; } // Check if the file exists if ( file_exists ( $ event -> file ) ) { if ( ! class_exists ( $ event -> className ) ) { $ this -> logger -> log ( 'Loading controller ' . $ event -> className . ' from file: ' . $ event -> file ) ; require $ event -> file ; } // Get the path the controller should know about $ path = implode ( '/' , $ this -> uri -> rsegments ) ; // And create the controller $ this -> callable = new $ event -> className ( $ path ) ; // If the controller does not want a function to be loaded, provide a halt parameter. if ( isset ( $ this -> callable -> halt ) ) { return false ; } // Check if method exists or if there is a caller function if ( method_exists ( $ this -> callable , $ event -> function ) || method_exists ( $ this -> callable , '__call' ) ) { // Run the routerCallMethodEvent $ methodEvent = Events :: fireEvent ( 'routerCallMethodEvent' ) ; if ( $ methodEvent -> isCancelled ( ) ) { return false ; } // Execute the function on the controller $ this -> output -> append_output ( $ this -> callable -> { $ event -> function } ( $ event -> parameters ) ) ; return true ; } else { // Function could not be found $ this -> logger -> log ( 'Could not find function ' . $ event -> function . ' on controller ' . $ event -> className ) ; $ this -> logger -> http_error ( 404 ) ; } } else { // Controller could not be found $ this -> logger -> log ( 'Could not find controller ' . $ event -> className ) ; $ this -> logger -> http_error ( 404 ) ; } return false ; }
The default callable.

This callable will do the 'old skool' routing. It will load the controllers from the controller-directory
in the application-directory.
The default callable .