build/GenerateTimeZonesMapData.php
private function parseTextFile()
    {
        $data = file($this->inputTextFile);

        $timeZoneMap = 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];
                $timezone = $parts[1];

                $timeZoneMap[$prefix] = $timezone;
            }
        }

        return $timeZoneMap;
    }
private function parseTextFile()
    {
        $data = file($this->inputTextFile);

        $timeZoneMap = 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];
                $timezone = $parts[1];

                $timeZoneMap[$prefix] = $timezone;
            }
        }

        return $timeZoneMap;
    }
private function parseTextFile ( ) { $ data = file ( $ this -> inputTextFile ) ; $ timeZoneMap = 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 ] ; $ timezone = $ parts [ 1 ] ; $ timeZoneMap [ $ prefix ] = $ timezone ; } } return $ timeZoneMap ; }
Reads phone prefix data from the provided input stream and returns a SortedMap with the
prefix to time zones mappings.
Reads phone prefix data from the provided input stream and returns a SortedMap with the prefix to time zones mappings .