public function getControllersForApp()
    {
        $controllers = [];
        $ctrlFolder = new Folder();

        /** @var Folder $ctrlFolder */
        $ctrlFolder->cd(ROOT . DS . 'src' . DS . 'Controller');

        if (!empty($ctrlFolder)) {
            $files = $ctrlFolder->find('.*Controller\.php$');
            $subLength = strlen('Controller.php');
            foreach ($files as $f) {
                $filename = basename($f);
                if ($filename === 'AppController.php') {
                    continue;
                }
                $ctrlName = substr($filename, 0, strlen($filename) - $subLength);
                $controllers[] = [
                    'name' => $ctrlName,
                    'path' => $ctrlFolder->path . DS . $f
                ];
            }
            $subFolders = $ctrlFolder->read(true, false, true)[0];
            foreach ($subFolders as $subFolder) {
                $ctrlFolder->cd($subFolder);
                $files = $ctrlFolder->find('.*Controller\.php$');
                $subLength = strlen('Controller.php');
                foreach ($files as $f) {
                    $filename = basename($f);
                    if ($filename === 'AppController.php') {
                        continue;
                    }
                    $ctrlName = substr($filename, 0, strlen($filename) - $subLength);
                    $controllers[] = [
                        'name' => $ctrlName,
                        'path' => $ctrlFolder->path . DS . $f
                    ];
                }
            }
        }

        return $controllers;
    }
public function getControllersForApp()
    {
        $controllers = [];
        $ctrlFolder = new Folder();

        /** @var Folder $ctrlFolder */
        $ctrlFolder->cd(ROOT . DS . 'src' . DS . 'Controller');

        if (!empty($ctrlFolder)) {
            $files = $ctrlFolder->find('.*Controller\.php$');
            $subLength = strlen('Controller.php');
            foreach ($files as $f) {
                $filename = basename($f);
                if ($filename === 'AppController.php') {
                    continue;
                }
                $ctrlName = substr($filename, 0, strlen($filename) - $subLength);
                $controllers[] = [
                    'name' => $ctrlName,
                    'path' => $ctrlFolder->path . DS . $f
                ];
            }
            $subFolders = $ctrlFolder->read(true, false, true)[0];
            foreach ($subFolders as $subFolder) {
                $ctrlFolder->cd($subFolder);
                $files = $ctrlFolder->find('.*Controller\.php$');
                $subLength = strlen('Controller.php');
                foreach ($files as $f) {
                    $filename = basename($f);
                    if ($filename === 'AppController.php') {
                        continue;
                    }
                    $ctrlName = substr($filename, 0, strlen($filename) - $subLength);
                    $controllers[] = [
                        'name' => $ctrlName,
                        'path' => $ctrlFolder->path . DS . $f
                    ];
                }
            }
        }

        return $controllers;
    }
public function getControllersForApp ( ) { $ controllers = [ ] ; $ ctrlFolder = new Folder ( ) ; /** @var Folder $ctrlFolder */ $ ctrlFolder -> cd ( ROOT . DS . 'src' . DS . 'Controller' ) ; if ( ! empty ( $ ctrlFolder ) ) { $ files = $ ctrlFolder -> find ( '.*Controller\.php$' ) ; $ subLength = strlen ( 'Controller.php' ) ; foreach ( $ files as $ f ) { $ filename = basename ( $ f ) ; if ( $ filename === 'AppController.php' ) { continue ; } $ ctrlName = substr ( $ filename , 0 , strlen ( $ filename ) - $ subLength ) ; $ controllers [ ] = [ 'name' => $ ctrlName , 'path' => $ ctrlFolder -> path . DS . $ f ] ; } $ subFolders = $ ctrlFolder -> read ( true , false , true ) [ 0 ] ; foreach ( $ subFolders as $ subFolder ) { $ ctrlFolder -> cd ( $ subFolder ) ; $ files = $ ctrlFolder -> find ( '.*Controller\.php$' ) ; $ subLength = strlen ( 'Controller.php' ) ; foreach ( $ files as $ f ) { $ filename = basename ( $ f ) ; if ( $ filename === 'AppController.php' ) { continue ; } $ ctrlName = substr ( $ filename , 0 , strlen ( $ filename ) - $ subLength ) ; $ controllers [ ] = [ 'name' => $ ctrlName , 'path' => $ ctrlFolder -> path . DS . $ f ] ; } } } return $ controllers ; }
Retrieve all controller names + paths for the app src.

@return array
Retrieve all controller names + paths for the app src .