protected function findNamespaceInController(&$controller)
    {
        if (strstr($controller, '\\')) {
            $namespace = explode('\\', $controller);
            $controller = end($namespace);
            $namespace = rtrim(join('\\', array_slice($namespace, 0, count($namespace) - 1)), '\\');
        } else {
            $namespace = isset($this->group['_namespace']) ? $this->group['namespace'] : null;
        }

        return $namespace;
    }