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

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

        $currencies = $this->helper->loadJsonFiles($directory = $this->helper->dataDir('third-party/world-currencies/package/src'));

        if ($currencies->isEmpty()) {
            throw new Exception("No currencies found in {$directory}");
        }

        $currencies = $currencies->mapWithKeys(function ($currency) {
            return $currency;
        });

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

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

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

            return [$item];
        };

        $getCodeClosure = function () {
        };

        $generateTaxData = function ($tax) {
            return $tax;
        };

        $currencies = $this->updater->generateJsonFiles($currencies, $dataDir, $normalizerClosure, $getCodeClosure, $generateTaxData, null);

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

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

        $currencies = $this->helper->loadJsonFiles($directory = $this->helper->dataDir('third-party/world-currencies/package/src'));

        if ($currencies->isEmpty()) {
            throw new Exception("No currencies found in {$directory}");
        }

        $currencies = $currencies->mapWithKeys(function ($currency) {
            return $currency;
        });

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

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

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

            return [$item];
        };

        $getCodeClosure = function () {
        };

        $generateTaxData = function ($tax) {
            return $tax;
        };

        $currencies = $this->updater->generateJsonFiles($currencies, $dataDir, $normalizerClosure, $getCodeClosure, $generateTaxData, null);

        $this->helper->progress('Generated '.count($currencies).' currencies.');
    }
public function update ( ) { $ this -> helper -> progress ( '--- Currencies' ) ; $ this -> helper -> eraseDataDir ( $ dataDir = '/currencies/default' ) ; $ currencies = $ this -> helper -> loadJsonFiles ( $ directory = $ this -> helper -> dataDir ( 'third-party/world-currencies/package/src' ) ) ; if ( $ currencies -> isEmpty ( ) ) { throw new Exception ( "No currencies found in {$directory}" ) ; } $ currencies = $ currencies -> mapWithKeys ( function ( $ currency ) { return $ currency ; } ) ; $ this -> helper -> message ( 'Processing currencies...' ) ; $ normalizerClosure = function ( $ item ) { $ item = $ this -> updater -> addDataSource ( $ item , 'world-currencies' ) ; $ item = $ this -> updater -> addRecordType ( $ item , 'currency' ) ; return [ $ item ] ; } ; $ getCodeClosure = function ( ) { } ; $ generateTaxData = function ( $ tax ) { return $ tax ; } ; $ currencies = $ this -> updater -> generateJsonFiles ( $ currencies , $ dataDir , $ normalizerClosure , $ getCodeClosure , $ generateTaxData , null ) ; $ this -> helper -> progress ( 'Generated ' . count ( $ currencies ) . ' currencies.' ) ; }
Update all currencies.

@throws Exception
Update all currencies .