MOON
Server: Apache
System: Linux server.royaltuning.hu 4.18.0-425.13.1.el8_7.x86_64 #1 SMP Tue Feb 21 04:20:52 EST 2023 x86_64
User: royaltuning (1001)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/local/apache/htdocs/Modules/Support/State.php
<?php

namespace Modules\Support;

class State
{
    /**
     * Path of the resource.
     *
     * @var string
     */
    const RESOURCE_PATH = __DIR__ . '/Resources/states';

    /**
     * Array of states.
     *
     * @var array
     */
    private static $states;

    /**
     * Get all states of the given country code.
     *
     * @param string $code
     * @return array|null
     */
    public static function get($code)
    {
        if (isset(self::$states[$code])) {
            return self::$states[$code];
        }

        $path = self::RESOURCE_PATH . "/{$code}.php";

        if (file_exists($path)) {
            return self::$states[$code] = require $path;
        }
    }

    public static function name($countryCode, $stateCode)
    {
        return array_get(self::get($countryCode), $stateCode);
    }
}