public static function getApiVersions(string $path = ''): array
    {
        $apis = [];
        $apiPath = (!empty($path)) ? $path : App::path('Controller/Api')[0];

        $dir = new Folder();
        // get folders in Controller/Api directory
        $tree = $dir->tree($apiPath, false, 'dir');

        foreach ($tree as $treePath) {
            if ($treePath === $apiPath) {
                continue;
            }

            $path = str_replace($apiPath, '', $treePath);

            preg_match('/V(\d+)\/V(\d+)/', $path, $matches);
            if (empty($matches)) {
                continue;
            }

            unset($matches[0]);
            $number = implode('.', $matches);

            $apis[] = [
                'number' => $number,
                'prefix' => self::getApiRoutePrefix($matches),
                'path' => self::getApiRoutePath($number),
            ];
        }

        if (!empty($apis)) {
            $apis = self::sortApiVersions($apis);
        }

        return $apis;
    }