rauwebieten/zipcodes

View on GitHub
src/ZipCodes.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace RauweBieten\ZipCodes;

class ZipCodes
{
    public static function getData($countryCode): array
    {
        $filePath = __DIR__.'/data/'.$countryCode.'.php';
        if (file_exists($filePath)) {
            /** @noinspection PhpIncludeInspection */
            return include $filePath;
        }

        throw new \RuntimeException("Country $countryCode not supported");
    }
}