private function parseTextFile($filePath, \Closure $handler)
    {
        if (!file_exists($filePath) || !is_readable($filePath)) {
            throw new \InvalidArgumentException("File '{$filePath}' does not exist");
        }

        $data = file($filePath);

        $countryData = array();

        foreach ($data as $line) {
            // Remove \n
            $line = str_replace(array("\n", "\r"), '', $line);
            $line = trim($line);

            if (strlen($line) == 0 || substr($line, 0, 1) == '#') {
                continue;
            }
            if (strpos($line, '|')) {
                // Valid line
                $parts = explode('|', $line);


                $prefix = $parts[0];
                $location = $parts[1];

                $handler($prefix, $location);
            }
        }

        return $countryData;
    }