src/Dispatch/AppRunner.php
protected function findController($object)
    {
        // Get the next URL argument
        $urlargs = $this->arguments;
        $arg = $urlargs->shift();

        // Store it as controller name
        $controller = $arg;
        
        // Strip any suffix
        if (($pos = strpos($controller, '.')) !== false)
            $controller = substr($controller, 0, $pos);
        
        // Check if the method exists
        if (!method_exists($object, $controller))
        {
            // Fall back to an index method
            if (method_exists($object, "index"))
            {
                if ($controller !== null)
                    $urlargs->unshift($arg);
                $controller = "index";
            }
            else
                throw new HTTPError(404, "Unknown controller: " . $controller);
        }
        return $controller;
    }
protected function findController($object)
    {
        // Get the next URL argument
        $urlargs = $this->arguments;
        $arg = $urlargs->shift();

        // Store it as controller name
        $controller = $arg;
        
        // Strip any suffix
        if (($pos = strpos($controller, '.')) !== false)
            $controller = substr($controller, 0, $pos);
        
        // Check if the method exists
        if (!method_exists($object, $controller))
        {
            // Fall back to an index method
            if (method_exists($object, "index"))
            {
                if ($controller !== null)
                    $urlargs->unshift($arg);
                $controller = "index";
            }
            else
                throw new HTTPError(404, "Unknown controller: " . $controller);
        }
        return $controller;
    }
Find the correct method in a controller to execute for the current request.
The route led to this controller, so the method is the first following URL argument.
Any suffix is stripped - method names may not contain dots anyway.
@param object $object The object from which to find a method to call.
@return callable A callable method in this object