__call() and interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello World :)

I need to write a class that implements a predefined interface. In my class all(or most) methods will use the same code. At first i thought the ideal solution would be to handle this by defining the magic __call() method in my class, but PHP then complains about the interface not being completely implemented. (Is there no way to tell PHP that the methods are handled by __call()?)

Options i see right now:
a) Just omit "implements SomeInterface" and PHP will stop complaining. This would be suboptimal as i want my class to "officially" conform to the standardized API which is defined in the interface. b) Implement all methods and just copy-paste the code. I find this rather ugly and it's a hassle to maintain. Is there a better solution than copy-paste(Keep in mind that the methods vary in argument types, argument counts and return value types)?

Somehow neither a) nor b) seems "the right way" to do what i want, so i would be glad to hear your opinions on this. I would also be interested what the best solution would be from a performance point of view.

Regards,
Mike

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux