public function registerGroups(string $namespace, string $basePath): self
    {
        $length   = \strlen($basePath) + 1;
        $iterator = Helper::directoryIterator($basePath, $this->getFileFilter());

        foreach ($iterator as $file) {
            $class = $namespace . '\\' . \substr($file, $length, -4);
            $this->addController($class);
        }

        return $this;
    }