我找到了下面的代碼。這是一種特定的模式還是可能是這樣構造代碼的原因 - 或者它只是假的?爲什麼邏輯在__destruct
class ExportCSV extends Export
{
// some private and public vars
public function __construct($arg)
{
// [...]
new CustomerReport($this);
}
public function procCallback($proc)
{
switch($proc){
case "customer":
new InvoiceReport($this);
break;
case "invoice":
new PrepaymentReport($this);
break;
case "prepayment":
new RefundReport($this);
break;
case "refund":
$this->sendMail();
break;
}
}
}
class CustomerReport extends Foobar
{
private $inst;
public function __construct($inst)
{
$this->inst = $inst;
$this->exportCustomers($inst->from, $inst->to);
}
public function __destruct()
{
$this->inst->procCallback("customer");
}
}
什麼'InvoiceReport'包含哪些內容? – JamesHalsall