Test for Interface membership

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Is there any way to determine if a class is a member of an interface?
For a concrete example: I am implementing a "node" (Node_if) interface
on database record representing objects (children of the abstract class
Data_class) that reflects that certain records have a parent-chld
relationship. (Others do not).

I'm generating a library Ordering_class that handles sorting operations
(i.e., users view a report of ordered objects and can move a specific
record up or down the listing with methods like
Ordering_class::move_up(Data_class $obj) ).

Naturally the ordering behavior of Node_if members will be different
than the ordering behavior of "flat" tables. (reordering behavior of
Node_if members will be restricted to siblings; reordering of
non-Node_if members can affect any member of the table)

Is there any way for Ordering_class::move_up(Data_class $obj) to test
$obj to determine that it is or is not a member of Node_if?

Re: Test for Interface membership

Check out is_a() and is_subclass_of();


Re: Test for Interface membership

ZeldorBlat wrote:

Quoted text here. Click to load it

PHP 5 *does* do interfaces, but I fail to excited about them - everytime
I've needed to know that much about an object, I just use method_exists()
or is_set().



Site Timeline