original_string: protected function downloadExchangeRatesTable()
      {
  
          try {
              $this->table[$this->baseCurrency] = 1;
  
              $xml = simplexml_load_file($this->url, 'SimpleXMLElement', LIBXML_NOWARNING);
  
              if ($xml instanceof \SimpleXMLElement) {
                  $data = $xml->xpath('//gesmes:Envelope/*[3]/*');
                  foreach ($data[0]->children() as $child) {
                      $currency               = (string)$child->attributes()->currency;
                      $exchangeRate           = (string)$child->attributes()->rate;
                      $this->table[$currency] = $exchangeRate;
                  }
              }
          } catch (\Exception $e) {
              throw new \RuntimeException('Cannot download rates from ECB.');
          }
  
      }
code: protected function downloadExchangeRatesTable()
      {
  
          try {
              $this->table[$this->baseCurrency] = 1;
  
              $xml = simplexml_load_file($this->url, 'SimpleXMLElement', LIBXML_NOWARNING);
  
              if ($xml instanceof \SimpleXMLElement) {
                  $data = $xml->xpath('//gesmes:Envelope/*[3]/*');
                  foreach ($data[0]->children() as $child) {
                      $currency               = (string)$child->attributes()->currency;
                      $exchangeRate           = (string)$child->attributes()->rate;
                      $this->table[$currency] = $exchangeRate;
                  }
              }
          } catch (\Exception $e) {
              throw new \RuntimeException('Cannot download rates from ECB.');
          }
  
      }
code_tokens: protected function downloadExchangeRatesTable ( ) { try { $ this -> table [ $ this -> baseCurrency ] = 1 ; $ xml = simplexml_load_file ( $ this -> url , 'SimpleXMLElement' , LIBXML_NOWARNING ) ; if ( $ xml instanceof \ SimpleXMLElement ) { $ data = $ xml -> xpath ( '//gesmes:Envelope/*[3]/*' ) ; foreach ( $ data [ 0 ] -> children ( ) as $ child ) { $ currency = ( string ) $ child -> attributes ( ) -> currency ; $ exchangeRate = ( string ) $ child -> attributes ( ) -> rate ; $ this -> table [ $ currency ] = $ exchangeRate ; } } } catch ( \ Exception $ e ) { throw new \ RuntimeException ( 'Cannot download rates from ECB.' ) ; } }
docstring: Downloads exchange rates table from ECB
docstring_tokens: Downloads exchange rates table from ECB