摘要:
高效的对象应该像PHP的整型那样运作:如果你把同一个对象资源赋值给两个不同的变量,然后改变其中的一个变量,另一个变量仍然不受影响。事实上,这就是Value Object模式的目标所在。 阅读全文
摘要:
class BadDollar { protected $amount; public function __construct($amount=0) { $this->amount = (float)$amount; } public function getAmount() { return $this->amount; } public function add($dollar)... 阅读全文