Quindi è più corretto così?
codice:class Customer{ private $id; public function __construct($id) { $this->id = $id; } public function getTransactions() { $i = 1; $result = array(); $currencyConverter = new currencyConverter(new CurrencyWebservice()); if (($handle = fopen("data.csv", "r")) !== false) { while (($data = fgetcsv($handle)) !== false) { if($i>1) { $line = explode(";",$data[0]); if($line[0] == $this->id) { $new_value = $currencyConverter->convert($line[2]); $row = "Transazione del $line[1]: $line[2] ==> €$new_value"; array_push($result, $row); } } $i++; } fclose($handle); } return $result; } }

Rispondi quotando