Skip to main content
3 events
when toggle format what by license comment
May 2, 2019 at 0:27 comment added Kain0_0 I'm not a PHP programmer... But the PHP manual has method_exists. There are other useful functions under related functions. As for Contracts the simplest is just function XYZContract(instance_to_check) { return (!method_exists(instance_to_check, "bob")); }. Specify as many checks as you want to describe the interface. As for more complex Contracts you may want to define a class with several functions under well known names for each form of verification. It might make sense to return a report object instead to detail the issues.
May 1, 2019 at 14:53 comment added coolpasta Ok, this makes sense and it's what I had in mind, but...code? :)
May 1, 2019 at 4:28 history answered Kain0_0 CC BY-SA 4.0