protected function _getNamespace($className, $pluginPath = null, $prefixPath = null)
    {
        $namespace = preg_replace('/(.*)Controller\//', '', $className);
        $namespace = preg_replace('/\//', '\\', $namespace);
        $namespace = preg_replace('/\.php/', '', $namespace);
        $prefixPath = preg_replace('/\//', '\\', Inflector::camelize($prefixPath));
        if (!$pluginPath) {
            $rootNamespace = Configure::read('App.namespace');
        } else {
            $rootNamespace = preg_replace('/\//', '\\', $pluginPath);
        }
        $namespace = [
            $rootNamespace,
            'Controller',
            $prefixPath,
            $namespace
        ];

        return implode('\\', Hash::filter($namespace));
    }
protected function _getNamespace($className, $pluginPath = null, $prefixPath = null)
    {
        $namespace = preg_replace('/(.*)Controller\//', '', $className);
        $namespace = preg_replace('/\//', '\\', $namespace);
        $namespace = preg_replace('/\.php/', '', $namespace);
        $prefixPath = preg_replace('/\//', '\\', Inflector::camelize($prefixPath));
        if (!$pluginPath) {
            $rootNamespace = Configure::read('App.namespace');
        } else {
            $rootNamespace = preg_replace('/\//', '\\', $pluginPath);
        }
        $namespace = [
            $rootNamespace,
            'Controller',
            $prefixPath,
            $namespace
        ];

        return implode('\\', Hash::filter($namespace));
    }
protected function _getNamespace ( $ className , $ pluginPath = null , $ prefixPath = null ) { $ namespace = preg_replace ( '/(.*)Controller\//' , '' , $ className ) ; $ namespace = preg_replace ( '/\//' , '\\' , $ namespace ) ; $ namespace = preg_replace ( '/\.php/' , '' , $ namespace ) ; $ prefixPath = preg_replace ( '/\//' , '\\' , Inflector :: camelize ( $ prefixPath ) ) ; if ( ! $ pluginPath ) { $ rootNamespace = Configure :: read ( 'App.namespace' ) ; } else { $ rootNamespace = preg_replace ( '/\//' , '\\' , $ pluginPath ) ; } $ namespace = [ $ rootNamespace , 'Controller' , $ prefixPath , $ namespace ] ; return implode ( '\\' , Hash :: filter ( $ namespace ) ) ; }
Get the namespace for a given class.

@param string $className The class you want a namespace for.
@param string $pluginPath The plugin path.
@param string $prefixPath The prefix path.
@return string
Get the namespace for a given class .