public function getProxy($proxyClass) { if ($this->proxy === null) { $this->proxy = new $proxyClass($this); } if (!is_a($this->proxy, $proxyClass)) { throw new InvalidArgumentException('Inconsistent proxy class requested.'); } return $this->proxy; }