Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/FinanceBankAPI/Fio.php

    r738 r873  
    1111  function Import($TimeFrom, $TimeTo)
    1212  {
    13     if($this->UserName == '') throw new Exception('Missing value for UserName property.');
    14     if($this->Password == '') throw new Exception('Missing value for Password property.');
    15     if(!is_numeric($this->Account)) throw new Exception('Missing or not numeric value for Account property.');
     13    if ($this->UserName == '') throw new Exception('Missing value for UserName property.');
     14    if ($this->Password == '') throw new Exception('Missing value for Password property.');
     15    if (!is_numeric($this->Account)) throw new Exception('Missing or not numeric value for Account property.');
    1616
    1717    $fp = fsockopen('ssl://www.fio.cz', 443, $errno, $errstr, 30);
    18     if(!$fp)
     18    if (!$fp)
    1919    {
    2020      throw new Exception('Connection error: '.$errstr);
     
    3535      // Read response
    3636      $Response = array();
    37       while(!feof($fp))
     37      while (!feof($fp))
    3838      {
    3939        $Response[] = trim(fgets($fp, 1024));
     
    4242
    4343      // Strip HTTP header
    44       while($Response[0] != '') array_shift($Response);
     44      while ($Response[0] != '') array_shift($Response);
    4545      array_shift($Response); // Remove empty line
    4646      //echo(implode("\n", $Response));
     
    4949      $GPC = new GPC();
    5050      $Result = array();
    51       foreach($Response as $Index => $Line)
     51      foreach ($Response as $Index => $Line)
    5252      {
    53         if(($Index == 0) and (substr($Line, 0, strlen(GPC_TYPE_REPORT)) != GPC_TYPE_REPORT)) $this->NoValidDataError($Response);
     53        if (($Index == 0) and (substr($Line, 0, strlen(GPC_TYPE_REPORT)) != GPC_TYPE_REPORT)) $this->NoValidDataError($Response);
    5454        $GPCLine = $GPC->ParseLine($Line);
    55         if($GPCLine != NULL) $Result[] = $GPCLine;
     55        if ($GPCLine != NULL) $Result[] = $GPCLine;
    5656      }
    57       return($Result);
     57      return ($Result);
    5858    }
    5959  }
     
    6565  $Response = implode('', $Response);
    6666    $ErrorMessageStart = '<div id="oldform_warning">';
    67     if(strpos($Response, $ErrorMessageStart) !== false)
     67    if (strpos($Response, $ErrorMessageStart) !== false)
    6868  {
    6969    $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart));
Note: See TracChangeset for help on using the changeset viewer.