app/Providers/CurrencyExchangeService/FxExchangeRateService.php
/**
     * Filter through the xml data and return only the needed Currency Rates
     *
     * @return array
     */
Filter through the xml data and return only the needed Currency Rates
@return array
Filter through the xml data and return only the needed Currency Rates @return array
public static function filterData(): array
    {
        $rates = [];
        if (self::$ratesXml !== null) {
            foreach (self::$ratesXml->channel->item as $item) {
                preg_match_all('/\((.*?)\)/', $item->title, $currencies);
                if (in_array($currencies[1][1], self::CURRENCIES, true)) {
                    $desc = explode('=', $item->description)[1];
                    preg_match('/[0-9\.]+/', $desc, $rate);
                    $rates[$currencies[1][1]]['rate'] = str_replace(',','',$rate[0]);
                }
            }
        }
        return $rates;
    }
public static function filterData ( ) : array { $ rates = [ ] ; if ( self :: $ ratesXml !== null ) { foreach ( self :: $ ratesXml -> channel -> item as $ item ) { preg_match_all ( '/\((.*?)\)/' , $ item -> title , $ currencies ) ; if ( in_array ( $ currencies [ 1 ] [ 1 ] , self :: CURRENCIES , true ) ) { $ desc = explode ( '=' , $ item -> description ) [ 1 ] ; preg_match ( '/[0-9\.]+/' , $ desc , $ rate ) ; $ rates [ $ currencies [ 1 ] [ 1 ] ] [ 'rate' ] = str_replace ( ',' , '' , $ rate [ 0 ] ) ; } } } return $ rates ; }
Filter through the xml data and return only the needed Currency Rates
 @return array
Filter through the xml data and return only the needed Currency Rates @return array