public function update()
    {
        $this->helper->progress('--- States');

        $this->helper->eraseDataDir($dataDir = '/states/default');

        $result = $this->helper->loadShapeFile('third-party/natural_earth/ne_10m_admin_1_states_provinces');

        $this->helper->message('Processing states...');

        $normalizerClosure = function ($item) {
            $item = $this->updater->addDataSource($item, 'natural');

            $item = $this->updater->addRecordType($item, 'state');

            return $this->updater->normalizeStateOrCityData($item);
        };

        $getCodeClosure = function ($item) {
            return $this->makeStatePostalCode($item);
        };

        $counter = 0;

        $mergerClosure = function ($states) use (&$counter) {
            if ($counter++ % 100 === 0) {
                $this->helper->message("Processed: $counter");
            }

            return $this->rinvex->mergeCountryStatesWithRinvex($states);
        };

        list(, $states) = $this->updater->generateJsonFiles($result, $dataDir, $normalizerClosure, $getCodeClosure, $mergerClosure);

        $this->helper->progress('Generated '.count($states).' states.');
    }
public function update()
    {
        $this->helper->progress('--- States');

        $this->helper->eraseDataDir($dataDir = '/states/default');

        $result = $this->helper->loadShapeFile('third-party/natural_earth/ne_10m_admin_1_states_provinces');

        $this->helper->message('Processing states...');

        $normalizerClosure = function ($item) {
            $item = $this->updater->addDataSource($item, 'natural');

            $item = $this->updater->addRecordType($item, 'state');

            return $this->updater->normalizeStateOrCityData($item);
        };

        $getCodeClosure = function ($item) {
            return $this->makeStatePostalCode($item);
        };

        $counter = 0;

        $mergerClosure = function ($states) use (&$counter) {
            if ($counter++ % 100 === 0) {
                $this->helper->message("Processed: $counter");
            }

            return $this->rinvex->mergeCountryStatesWithRinvex($states);
        };

        list(, $states) = $this->updater->generateJsonFiles($result, $dataDir, $normalizerClosure, $getCodeClosure, $mergerClosure);

        $this->helper->progress('Generated '.count($states).' states.');
    }
public function update ( ) { $ this -> helper -> progress ( '--- States' ) ; $ this -> helper -> eraseDataDir ( $ dataDir = '/states/default' ) ; $ result = $ this -> helper -> loadShapeFile ( 'third-party/natural_earth/ne_10m_admin_1_states_provinces' ) ; $ this -> helper -> message ( 'Processing states...' ) ; $ normalizerClosure = function ( $ item ) { $ item = $ this -> updater -> addDataSource ( $ item , 'natural' ) ; $ item = $ this -> updater -> addRecordType ( $ item , 'state' ) ; return $ this -> updater -> normalizeStateOrCityData ( $ item ) ; } ; $ getCodeClosure = function ( $ item ) { return $ this -> makeStatePostalCode ( $ item ) ; } ; $ counter = 0 ; $ mergerClosure = function ( $ states ) use ( & $ counter ) { if ( $ counter ++ % 100 === 0 ) { $ this -> helper -> message ( "Processed: $counter" ) ; } return $ this -> rinvex -> mergeCountryStatesWithRinvex ( $ states ) ; } ; list ( , $ states ) = $ this -> updater -> generateJsonFiles ( $ result , $ dataDir , $ normalizerClosure , $ getCodeClosure , $ mergerClosure ) ; $ this -> helper -> progress ( 'Generated ' . count ( $ states ) . ' states.' ) ; }
Update states.
Update states .