다음 코드를 발견했습니다. 이것은 특정 패턴입니까? 아니면 그런 식으로 코드를 구조화하는 이유가 될 수 있습니까? 아니면 그냥 가짜입니까?왜 __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