public static function getDirControllers(string $path, string $plugin = null, bool $fqcn = true): array
    {
        $result = [];

        try {
            static::validatePath($path);
            $dir = new DirectoryIterator($path);
        } catch (InvalidArgumentException $e) {
            return $result;
        } catch (UnexpectedValueException $e) {
            return $result;
        }

        foreach ($dir as $fileinfo) {
            // skip directories
            if (!$fileinfo->isFile()) {
                continue;
            }

            $className = $fileinfo->getBasename('.php');

            // skip AppController
            if ('AppController' === $className) {
                continue;
            }

            if (!empty($plugin)) {
                $className = $plugin . '.' . $className;
            }

            if ($fqcn) {
                $className = App::className($className, 'Controller');
            }

            if ($className) {
                $result[] = $className;
            }
        }

        return $result;
    }
public static function getDirControllers(string $path, string $plugin = null, bool $fqcn = true): array
    {
        $result = [];

        try {
            static::validatePath($path);
            $dir = new DirectoryIterator($path);
        } catch (InvalidArgumentException $e) {
            return $result;
        } catch (UnexpectedValueException $e) {
            return $result;
        }

        foreach ($dir as $fileinfo) {
            // skip directories
            if (!$fileinfo->isFile()) {
                continue;
            }

            $className = $fileinfo->getBasename('.php');

            // skip AppController
            if ('AppController' === $className) {
                continue;
            }

            if (!empty($plugin)) {
                $className = $plugin . '.' . $className;
            }

            if ($fqcn) {
                $className = App::className($className, 'Controller');
            }

            if ($className) {
                $result[] = $className;
            }
        }

        return $result;
    }
public static function getDirControllers ( string $ path , string $ plugin = null , bool $ fqcn = true ) : array { $ result = [ ] ; try { static :: validatePath ( $ path ) ; $ dir = new DirectoryIterator ( $ path ) ; } catch ( InvalidArgumentException $ e ) { return $ result ; } catch ( UnexpectedValueException $ e ) { return $ result ; } foreach ( $ dir as $ fileinfo ) { // skip directories if ( ! $ fileinfo -> isFile ( ) ) { continue ; } $ className = $ fileinfo -> getBasename ( '.php' ) ; // skip AppController if ( 'AppController' === $ className ) { continue ; } if ( ! empty ( $ plugin ) ) { $ className = $ plugin . '.' . $ className ; } if ( $ fqcn ) { $ className = App :: className ( $ className , 'Controller' ) ; } if ( $ className ) { $ result [ ] = $ className ; } } return $ result ; }
Method that retrieves controller names found on the provided directory path.

@param string $path Directory path
@param string $plugin Plugin name
@param bool $fqcn Flag for using fqcn
@return mixed[]
Method that retrieves controller names found on the provided directory path .