inputTextFile = $inputFile; if (!is_readable($this->inputTextFile)) { throw new \RuntimeException("The provided input text file does not exist."); } $data = $this->parseTextFile(); $this->writeMappingFile($outputDir, $data); } /** * Reads phone prefix data from the provided input stream and returns a SortedMap with the * prefix to time zones mappings. */ private function parseTextFile() { $data = file($this->inputTextFile); $timeZoneMap = array(); foreach ($data as $line) { // Remove \n $line = str_replace("\n", "", $line); $line = str_replace("\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]; $timezone = $parts[1]; $timeZoneMap[$prefix] = $timezone; } } return $timeZoneMap; } private function writeMappingFile($outputFile, $data) { $phpSource = '