public function getControllerClass(ServerRequest $request)
    {
        $pluginPath = $controller = null;
        $namespace = 'Controller';
        if ($request->getParam('controller')) {
            $controller = $request->getParam('controller');
        }
        if ($request->getParam('plugin')) {
            $pluginPath = $request->getParam('plugin') . '.';
        }
        if ($request->getParam('prefix')) {
            if (strpos($request->getParam('prefix'), '/') === false) {
                $namespace .= '/' . Inflector::camelize($request->getParam('prefix'));
            } else {
                $prefixes = array_map(
                    'Cake\Utility\Inflector::camelize',
                    explode('/', $request->getParam('prefix'))
                );
                $namespace .= '/' . implode('/', $prefixes);
            }
        }
        $firstChar = substr($controller, 0, 1);

        // Disallow plugin short forms, / and \\ from
        // controller names as they allow direct references to
        // be created.
        if (strpos($controller, '\\') !== false ||
            strpos($controller, '/') !== false ||
            strpos($controller, '.') !== false ||
            $firstChar === strtolower($firstChar)
        ) {
            $this->missingController($request);
        }

        return App::className($pluginPath . $controller, $namespace, 'Controller') ?: null;
    }
public function getControllerClass(ServerRequest $request)
    {
        $pluginPath = $controller = null;
        $namespace = 'Controller';
        if ($request->getParam('controller')) {
            $controller = $request->getParam('controller');
        }
        if ($request->getParam('plugin')) {
            $pluginPath = $request->getParam('plugin') . '.';
        }
        if ($request->getParam('prefix')) {
            if (strpos($request->getParam('prefix'), '/') === false) {
                $namespace .= '/' . Inflector::camelize($request->getParam('prefix'));
            } else {
                $prefixes = array_map(
                    'Cake\Utility\Inflector::camelize',
                    explode('/', $request->getParam('prefix'))
                );
                $namespace .= '/' . implode('/', $prefixes);
            }
        }
        $firstChar = substr($controller, 0, 1);

        // Disallow plugin short forms, / and \\ from
        // controller names as they allow direct references to
        // be created.
        if (strpos($controller, '\\') !== false ||
            strpos($controller, '/') !== false ||
            strpos($controller, '.') !== false ||
            $firstChar === strtolower($firstChar)
        ) {
            $this->missingController($request);
        }

        return App::className($pluginPath . $controller, $namespace, 'Controller') ?: null;
    }
public function getControllerClass ( ServerRequest $ request ) { $ pluginPath = $ controller = null ; $ namespace = 'Controller' ; if ( $ request -> getParam ( 'controller' ) ) { $ controller = $ request -> getParam ( 'controller' ) ; } if ( $ request -> getParam ( 'plugin' ) ) { $ pluginPath = $ request -> getParam ( 'plugin' ) . '.' ; } if ( $ request -> getParam ( 'prefix' ) ) { if ( strpos ( $ request -> getParam ( 'prefix' ) , '/' ) === false ) { $ namespace .= '/' . Inflector :: camelize ( $ request -> getParam ( 'prefix' ) ) ; } else { $ prefixes = array_map ( 'Cake\Utility\Inflector::camelize' , explode ( '/' , $ request -> getParam ( 'prefix' ) ) ) ; $ namespace .= '/' . implode ( '/' , $ prefixes ) ; } } $ firstChar = substr ( $ controller , 0 , 1 ) ; // Disallow plugin short forms, / and \\ from // controller names as they allow direct references to // be created. if ( strpos ( $ controller , '\\' ) !== false || strpos ( $ controller , '/' ) !== false || strpos ( $ controller , '.' ) !== false || $ firstChar === strtolower ( $ firstChar ) ) { $ this -> missingController ( $ request ) ; } return App :: className ( $ pluginPath . $ controller , $ namespace , 'Controller' ) ? : null ; }
Determine the controller class name based on current request and controller param

@param \Cake\Http\ServerRequest $request The request to build a controller for.
@return string|null
Determine the controller class name based on current request and controller param