src/CarteBlanche/Controller/Dev.php
public function app_mapAction()
    {
        $root_path = CarteBlanche::getPath('root_path');
        $base_path = $root_path;
        $bundles_base_path = $root_path
            .CarteBlanche::getPath('bundles_dir');
        $controller_dirname = 'Controller';

        $app_controllers = $bundles_controllers = array();
    /*
        $classMap = require __DIR__ . '/autoload_classmap.php';
        if ($classMap) {
            $loader->addClassMap($classMap);
        }
    */
        // the global app dir
        $_dir = new \CarteBlanche\Model\DirectoryModel;
        $_dir->setPath(CarteBlanche::getPath('carte_blanche_core'));
        $_dir->setDirname( $controller_dirname );
        $_app_ctrls = $_dir->scanDir();
        if ($_app_ctrls) {
            foreach ($_app_ctrls as $_ctrl) {
                $controller = new \stdClass;
                $controller->short_name = str_replace('.php', '', $_ctrl);
                $controller->name = \CarteBlanche\App\Locator::locateController($controller->short_name);
                $controller->path = $base_path.$controller_dirname.'/'.$_ctrl;
                $controller->methods = array();
                if (\CarteBlanche\App\Loader::classExists($controller->name)) {
                    $_cls = new \ReflectionClass( $controller->name );
                    foreach ($_cls->getMethods(\ReflectionMethod::IS_PUBLIC) as $_meth) {
                        if (strstr($_meth->name, 'Action')) {
                            $method = new \stdClass;
                            $method->name = $_meth->name;
                            $method->short_name = str_replace('Action', '', $_meth->name);
                            $method->expect_arguments = false;
                            foreach ($_meth->getParameters() as $_param) {
                                if (!$_param->isOptional()) {
                                    $method->expect_arguments = true;
                                    continue;
                                }
                            }
                            $controller->methods[] = $method;
                        }
                    }
                }
                $app_controllers[] = $controller;
            }
        }

        // the bundles dirs
        $known_bundles = $this->getContainer()->get('bundles');
        if (is_null($known_bundles)) $known_bundles = array();
        $known_bundles_lower = $known_bundles;
        foreach ($known_bundles_lower as $key=>$k) {
            $known_bundles_lower[strtolower($key)] = $k;
        }
        $_dir->setPath(dirname($bundles_base_path));
        $_dir->setDirname(basename($bundles_base_path));
        $_bundles = $_dir->scanDir();
        if ($_bundles) {
            $_bundle_dir = new \CarteBlanche\Model\DirectoryModel;
            $_bundle_dir->setPath( $bundles_base_path );
            foreach ($_bundles as $_bundle) {
                if (!array_key_exists($_bundle, $known_bundles) && !array_key_exists($_bundle, $known_bundles_lower)) {
                    foreach ($known_bundles as $nm=>$bdl) {
                        if ($bdl->getShortname()==$_bundle) {
                            $_bundle = $nm;
                        }
                    }
                    if (!array_key_exists($_bundle, $known_bundles) && !array_key_exists($_bundle, $known_bundles_lower)) {
                        continue;
                    }
                }
                if (array_key_exists($_bundle, $known_bundles)) {
                    $this_bundle_path = $known_bundles[$_bundle]->getDirectory()
                        .'/'.$known_bundles[$_bundle]->getNamespace();
                }
                if (array_key_exists($_bundle, $known_bundles_lower)) {
                    $this_bundle_path = $known_bundles_lower[$_bundle]->getDirectory()
                        .'/'.$known_bundles_lower[$_bundle]->getNamespace();
                }
                $bundles_controllers[$_bundle] = array();
                $_bundle_dir->setDirname( str_replace($_bundle_dir->getPath(), '', $this_bundle_path.'/'.$controller_dirname) );
                $_bundles_ctrls = $_bundle_dir->scanDir();

                if ($_bundles_ctrls)
                foreach ($_bundles_ctrls as $_ctrl) {
                    $controller = new \stdClass;
                    $controller->short_name = str_replace('.php', '', $_ctrl);
                    $controller->name = '\\'.$_bundle.'\\Controller\\'.$controller->short_name;
                    $controller->path = $bundles_base_path.$_bundle.'/'.$controller_dirname.'/'.$_ctrl;
                    $controller->methods = array();
                    if (\CarteBlanche\App\Loader::classExists($controller->name)) {
                        $_cls = new \ReflectionClass( $controller->name );
                        if ($_cls->isAbstract()) {
                            continue;
                        }
                        foreach ($_cls->getMethods(\ReflectionMethod::IS_PUBLIC) as $_meth) {
                            if (strstr($_meth->name, 'Action')) {
                                $method = new \stdClass;
                                $method->name = $_meth->name;
                                $method->short_name = str_replace('Action', '', $_meth->name);
                                $method->expect_arguments = false;
                                foreach ($_meth->getParameters() as $_param) {
                                    if (!$_param->isOptional()) {
                                        $method->expect_arguments = true;
                                        break;
                                    }
                                }
                                $controller->methods[] = $method;
                            }
                        }
                    }
                    $bundles_controllers[$_bundle][] = $controller;
                }
            }
        }

        $mode_data = \CarteBlanche\CarteBlanche::getKernelMode(true);
        return array(self::$views_dir.'app_map', array(
            'title' => $this->trans('Application full map'),
            'debug' => isset($mode_data['debug']) ? $mode_data['debug'] : false,
            'app_controllers'=>$app_controllers,
            'bundles_controllers' => $bundles_controllers,
        ));
    }
public function app_mapAction()
    {
        $root_path = CarteBlanche::getPath('root_path');
        $base_path = $root_path;
        $bundles_base_path = $root_path
            .CarteBlanche::getPath('bundles_dir');
        $controller_dirname = 'Controller';

        $app_controllers = $bundles_controllers = array();
    /*
        $classMap = require __DIR__ . '/autoload_classmap.php';
        if ($classMap) {
            $loader->addClassMap($classMap);
        }
    */
        // the global app dir
        $_dir = new \CarteBlanche\Model\DirectoryModel;
        $_dir->setPath(CarteBlanche::getPath('carte_blanche_core'));
        $_dir->setDirname( $controller_dirname );
        $_app_ctrls = $_dir->scanDir();
        if ($_app_ctrls) {
            foreach ($_app_ctrls as $_ctrl) {
                $controller = new \stdClass;
                $controller->short_name = str_replace('.php', '', $_ctrl);
                $controller->name = \CarteBlanche\App\Locator::locateController($controller->short_name);
                $controller->path = $base_path.$controller_dirname.'/'.$_ctrl;
                $controller->methods = array();
                if (\CarteBlanche\App\Loader::classExists($controller->name)) {
                    $_cls = new \ReflectionClass( $controller->name );
                    foreach ($_cls->getMethods(\ReflectionMethod::IS_PUBLIC) as $_meth) {
                        if (strstr($_meth->name, 'Action')) {
                            $method = new \stdClass;
                            $method->name = $_meth->name;
                            $method->short_name = str_replace('Action', '', $_meth->name);
                            $method->expect_arguments = false;
                            foreach ($_meth->getParameters() as $_param) {
                                if (!$_param->isOptional()) {
                                    $method->expect_arguments = true;
                                    continue;
                                }
                            }
                            $controller->methods[] = $method;
                        }
                    }
                }
                $app_controllers[] = $controller;
            }
        }

        // the bundles dirs
        $known_bundles = $this->getContainer()->get('bundles');
        if (is_null($known_bundles)) $known_bundles = array();
        $known_bundles_lower = $known_bundles;
        foreach ($known_bundles_lower as $key=>$k) {
            $known_bundles_lower[strtolower($key)] = $k;
        }
        $_dir->setPath(dirname($bundles_base_path));
        $_dir->setDirname(basename($bundles_base_path));
        $_bundles = $_dir->scanDir();
        if ($_bundles) {
            $_bundle_dir = new \CarteBlanche\Model\DirectoryModel;
            $_bundle_dir->setPath( $bundles_base_path );
            foreach ($_bundles as $_bundle) {
                if (!array_key_exists($_bundle, $known_bundles) && !array_key_exists($_bundle, $known_bundles_lower)) {
                    foreach ($known_bundles as $nm=>$bdl) {
                        if ($bdl->getShortname()==$_bundle) {
                            $_bundle = $nm;
                        }
                    }
                    if (!array_key_exists($_bundle, $known_bundles) && !array_key_exists($_bundle, $known_bundles_lower)) {
                        continue;
                    }
                }
                if (array_key_exists($_bundle, $known_bundles)) {
                    $this_bundle_path = $known_bundles[$_bundle]->getDirectory()
                        .'/'.$known_bundles[$_bundle]->getNamespace();
                }
                if (array_key_exists($_bundle, $known_bundles_lower)) {
                    $this_bundle_path = $known_bundles_lower[$_bundle]->getDirectory()
                        .'/'.$known_bundles_lower[$_bundle]->getNamespace();
                }
                $bundles_controllers[$_bundle] = array();
                $_bundle_dir->setDirname( str_replace($_bundle_dir->getPath(), '', $this_bundle_path.'/'.$controller_dirname) );
                $_bundles_ctrls = $_bundle_dir->scanDir();

                if ($_bundles_ctrls)
                foreach ($_bundles_ctrls as $_ctrl) {
                    $controller = new \stdClass;
                    $controller->short_name = str_replace('.php', '', $_ctrl);
                    $controller->name = '\\'.$_bundle.'\\Controller\\'.$controller->short_name;
                    $controller->path = $bundles_base_path.$_bundle.'/'.$controller_dirname.'/'.$_ctrl;
                    $controller->methods = array();
                    if (\CarteBlanche\App\Loader::classExists($controller->name)) {
                        $_cls = new \ReflectionClass( $controller->name );
                        if ($_cls->isAbstract()) {
                            continue;
                        }
                        foreach ($_cls->getMethods(\ReflectionMethod::IS_PUBLIC) as $_meth) {
                            if (strstr($_meth->name, 'Action')) {
                                $method = new \stdClass;
                                $method->name = $_meth->name;
                                $method->short_name = str_replace('Action', '', $_meth->name);
                                $method->expect_arguments = false;
                                foreach ($_meth->getParameters() as $_param) {
                                    if (!$_param->isOptional()) {
                                        $method->expect_arguments = true;
                                        break;
                                    }
                                }
                                $controller->methods[] = $method;
                            }
                        }
                    }
                    $bundles_controllers[$_bundle][] = $controller;
                }
            }
        }

        $mode_data = \CarteBlanche\CarteBlanche::getKernelMode(true);
        return array(self::$views_dir.'app_map', array(
            'title' => $this->trans('Application full map'),
            'debug' => isset($mode_data['debug']) ? $mode_data['debug'] : false,
            'app_controllers'=>$app_controllers,
            'bundles_controllers' => $bundles_controllers,
        ));
    }
Page of application map

@return string The view content