Skip to content
Snippets Groups Projects
Select Git revision
  • 81e0dabcc46e5aa02741c13cb02fe169ea02b053
  • main default protected
2 results

SupportedPHPVersions.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    SupportedPHPVersions.php 832 B
    <?php
    namespace Studip\Dockerized;
    
    final class SupportedPHPVersions
    {
        private const CONFIGURATION = [
            '7.2' => [8072, 8872],
            '7.3' => [8073, 8873],
            '7.4' => [8074, 8874],
            '8.0' => [8080, 8880],
            '8.1' => [8081, 8881],
            '8.2' => [8082, 8882],
            '8.3' => [8083, 8883],
        ];
    
        private const DEFAULT = ['7.4', '8.1', '8.3'];
    
        public static function getVersions(): array
        {
            return array_keys(self::CONFIGURATION);
        }
    
        public static function getDefaultVersions(): array
        {
            return self::DEFAULT;
        }
    
        public static function mapPort(string $version): int
        {
            if (!isset(self::CONFIGURATION[$version])) {
                throw new \Exception('Unsupported php version');
            }
            return self::CONFIGURATION[$version];
        }
    }