admin/controllers/AdminRouter.php
protected function loadAdminClass($fileName, $className, $classPath, $moduleName)
    {
        //  Does the expected class exist?
        if (!class_exists($className)) {
            return false;
        }

        //  Does it have an announce method?
        if (!method_exists($className, 'announce')) {
            return false;
        }

        //  Cool! We have a controller which is valid, Add it to the stack!
        if (!isset($this->adminControllers[$moduleName])) {
            $this->adminControllers[$moduleName]              = new \stdClass();
            $this->adminControllers[$moduleName]->controllers = [];
        }

        $aNavGroupings = $className::announce();

        if (!empty($aNavGroupings) && !is_array($aNavGroupings) && !($aNavGroupings instanceof \Nails\Admin\Factory\Nav)) {

            /**
             * @todo Use an admin specific exception class, and autoload it.
             */

            throw new RouterException('Admin Nav groupings returned by ' . $className . '::announce() were invalid', 1);

        } elseif (!is_array($aNavGroupings)) {
            $aNavGroupings = array_filter([$aNavGroupings]);
        }

        $this->adminControllers[$moduleName]->controllers[$fileName] = [
            'className' => (string) $className,
            'path'      => (string) $classPath,
            'groupings' => $aNavGroupings,
        ];

        return true;
    }
protected function loadAdminClass($fileName, $className, $classPath, $moduleName)
    {
        //  Does the expected class exist?
        if (!class_exists($className)) {
            return false;
        }

        //  Does it have an announce method?
        if (!method_exists($className, 'announce')) {
            return false;
        }

        //  Cool! We have a controller which is valid, Add it to the stack!
        if (!isset($this->adminControllers[$moduleName])) {
            $this->adminControllers[$moduleName]              = new \stdClass();
            $this->adminControllers[$moduleName]->controllers = [];
        }

        $aNavGroupings = $className::announce();

        if (!empty($aNavGroupings) && !is_array($aNavGroupings) && !($aNavGroupings instanceof \Nails\Admin\Factory\Nav)) {

            /**
             * @todo Use an admin specific exception class, and autoload it.
             */

            throw new RouterException('Admin Nav groupings returned by ' . $className . '::announce() were invalid', 1);

        } elseif (!is_array($aNavGroupings)) {
            $aNavGroupings = array_filter([$aNavGroupings]);
        }

        $this->adminControllers[$moduleName]->controllers[$fileName] = [
            'className' => (string) $className,
            'path'      => (string) $classPath,
            'groupings' => $aNavGroupings,
        ];

        return true;
    }
Attempts to load an AdminClass

@param  string $fileName   The filename of the class being loaded
@param  string $className  The name of the class being loaded
@param  string $classPath  The path of the class being loaded
@param  string $moduleName The name of the module to which this class belongs

@throws RouterException
@return boolean