private function write_interface_delegate($class, $variable_name, $interface_name) { $ref = new \ReflectionClass($interface_name); if (!$ref->isInterface()) { $this->error("can't delegate \${$variable_name} to {$interface_name} - not an interface"); } foreach ($ref->getMethods() as $method) { $class->add_method(Method::create_delegate_for_reflection($method, $variable_name)); } }