File: //home/marketing.cfbon.ru/public_html/app/Services/MetroService.php
<?php
namespace App\Services;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
class MetroService
{
    protected object $data;
    public function __construct(string $filePath)
    {
        $this->data = cache()->remember('metro_data', 3600, function () use ($filePath) {
            return json_decode(File::get(config_path($filePath)));
        });
    }
    public function getAllStations() : Collection
    {
        return collect($this->data->lines);
    }
    public function getColor(string $station): ?string
    {
        foreach ($this->data->lines as $line) {
            if (in_array($station, $line->stations)) {
                return $line->color;
            }
        }
        return null;
    }
}