ZF\Apigility\Admin\Model\ModuleModel::getVersionsByModule PHP Method

getVersionsByModule() protected method

Checks each REST and RPC service name for a version subnamespace; if found, that version is added to the list.
protected getVersionsByModule ( string $moduleName, ZF\Apigility\Provider\ApigilityProviderInterface | ZF\Apigility\ApigilityModuleInterface $module ) : array
$moduleName string
$module ZF\Apigility\Provider\ApigilityProviderInterface | ZF\Apigility\ApigilityModuleInterface
return array
    protected function getVersionsByModule($moduleName, $module)
    {
        if (!$module instanceof ApigilityProviderInterface && !$module instanceof ApigilityModuleInterface) {
            throw new Exception\InvalidArgumentException('Expected ApigilityProviderInterface or ApigilityModuleInterface');
        }
        $path = $this->detectSourcePathFromModule($moduleName, $module);
        $versions = [];
        foreach (Glob::glob($path . DIRECTORY_SEPARATOR . 'V*') as $dir) {
            if (preg_match('/\\V(?P<version>\\d+)$/', $dir, $matches)) {
                $versions[] = (int) $matches['version'];
            }
        }
        if (!$versions) {
            return [1];
        }
        sort($versions);
        return $versions;
    }