public function buildCountriesCoollection($dataDir)
    {
        $this->helper->message('Processing countries...');

        $mledoze = $this->mledoze->loadMledozeCountries();

        $shapeFile = $this->helper->loadShapeFile('third-party/natural_earth/ne_10m_admin_0_countries');

        $this->helper->message('Generating countries...');

        $countries = coollect($shapeFile)->map(function ($country) {
            return $this->natural->fixNaturalOddCountries($country);
        })->mapWithKeys(function ($natural) use ($mledoze, $dataDir) {
            list($mledoze, $countryCode) = $this->mledoze->findMledozeCountry($mledoze, $natural);

            $natural = coollect($natural)->mapWithKeys(function ($country, $key) {
                return [strtolower($key) => $country];
            });

            if (is_null($countryCode)) {
                $result = $this->mledoze->fillMledozeFields($natural);

                $countryCode = $natural['adm0_a3'];
            } else {
                $result = $this->mledoze->mergeWithMledoze($mledoze, $natural);
            }

            $result = $this->rinvex->mergeWithRinvex(
                $result,
                $this->rinvex->findRinvexCountry($result),
                $this->rinvex->findRinvexTranslations($result)
            );

            $result = $this->clearCountryCurrencies($result);

            $result = $this->updater->addDataSource($result, 'natural');

            $result = $this->updater->addRecordType($result, 'country');

            $result = $result->sortByKeysRecursive();

            $this->helper->putFile(
                $this->helper->makeJsonFileName(strtolower($countryCode), $dataDir),
                $result->toJson(JSON_PRETTY_PRINT)
            );

            $this->helper->message($result['name']['common']);

            return [$countryCode => $result];
        });

        return $mledoze->overwrite($countries);
    }
public function buildCountriesCoollection($dataDir)
    {
        $this->helper->message('Processing countries...');

        $mledoze = $this->mledoze->loadMledozeCountries();

        $shapeFile = $this->helper->loadShapeFile('third-party/natural_earth/ne_10m_admin_0_countries');

        $this->helper->message('Generating countries...');

        $countries = coollect($shapeFile)->map(function ($country) {
            return $this->natural->fixNaturalOddCountries($country);
        })->mapWithKeys(function ($natural) use ($mledoze, $dataDir) {
            list($mledoze, $countryCode) = $this->mledoze->findMledozeCountry($mledoze, $natural);

            $natural = coollect($natural)->mapWithKeys(function ($country, $key) {
                return [strtolower($key) => $country];
            });

            if (is_null($countryCode)) {
                $result = $this->mledoze->fillMledozeFields($natural);

                $countryCode = $natural['adm0_a3'];
            } else {
                $result = $this->mledoze->mergeWithMledoze($mledoze, $natural);
            }

            $result = $this->rinvex->mergeWithRinvex(
                $result,
                $this->rinvex->findRinvexCountry($result),
                $this->rinvex->findRinvexTranslations($result)
            );

            $result = $this->clearCountryCurrencies($result);

            $result = $this->updater->addDataSource($result, 'natural');

            $result = $this->updater->addRecordType($result, 'country');

            $result = $result->sortByKeysRecursive();

            $this->helper->putFile(
                $this->helper->makeJsonFileName(strtolower($countryCode), $dataDir),
                $result->toJson(JSON_PRETTY_PRINT)
            );

            $this->helper->message($result['name']['common']);

            return [$countryCode => $result];
        });

        return $mledoze->overwrite($countries);
    }
public function buildCountriesCoollection ( $ dataDir ) { $ this -> helper -> message ( 'Processing countries...' ) ; $ mledoze = $ this -> mledoze -> loadMledozeCountries ( ) ; $ shapeFile = $ this -> helper -> loadShapeFile ( 'third-party/natural_earth/ne_10m_admin_0_countries' ) ; $ this -> helper -> message ( 'Generating countries...' ) ; $ countries = coollect ( $ shapeFile ) -> map ( function ( $ country ) { return $ this -> natural -> fixNaturalOddCountries ( $ country ) ; } ) -> mapWithKeys ( function ( $ natural ) use ( $ mledoze , $ dataDir ) { list ( $ mledoze , $ countryCode ) = $ this -> mledoze -> findMledozeCountry ( $ mledoze , $ natural ) ; $ natural = coollect ( $ natural ) -> mapWithKeys ( function ( $ country , $ key ) { return [ strtolower ( $ key ) => $ country ] ; } ) ; if ( is_null ( $ countryCode ) ) { $ result = $ this -> mledoze -> fillMledozeFields ( $ natural ) ; $ countryCode = $ natural [ 'adm0_a3' ] ; } else { $ result = $ this -> mledoze -> mergeWithMledoze ( $ mledoze , $ natural ) ; } $ result = $ this -> rinvex -> mergeWithRinvex ( $ result , $ this -> rinvex -> findRinvexCountry ( $ result ) , $ this -> rinvex -> findRinvexTranslations ( $ result ) ) ; $ result = $ this -> clearCountryCurrencies ( $ result ) ; $ result = $ this -> updater -> addDataSource ( $ result , 'natural' ) ; $ result = $ this -> updater -> addRecordType ( $ result , 'country' ) ; $ result = $ result -> sortByKeysRecursive ( ) ; $ this -> helper -> putFile ( $ this -> helper -> makeJsonFileName ( strtolower ( $ countryCode ) , $ dataDir ) , $ result -> toJson ( JSON_PRETTY_PRINT ) ) ; $ this -> helper -> message ( $ result [ 'name' ] [ 'common' ] ) ; return [ $ countryCode => $ result ] ; } ) ; return $ mledoze -> overwrite ( $ countries ) ; }
Build countries collection.

@param $dataDir
@return \PragmaRX\Coollection\Package\Coollection
Build countries collection .