function setDelegate($delegate) { if ($delegate instanceof Filter) { $delegate = new Delegate($filter); } if (!$delegate instanceof Delegate || !$delegate->isType('IO\\Filter')) { throw new \Core\Exception('Filter delegate must be instance of a Filter'); } $this->delegate = $delegate; }