implements
- Ariadne >
- Library >
- Ariadne 2.4 >
- Manuals >
- Programmers Reference >
- Classes >
- Object >
- PINP Methods >
(bool) implements($interface)
Checks whether the current object implements the given class or interface.
| Argument | Description |
|---|---|
| (string) $interface | The name of the class or interface the object should implement. |
implements() allows you to build generic templates that
differ on certain points based on the class of the object, or the interfaces it
implements.
PHP, and therefor Ariadne, uses single inheritance. Classes cannot inherit
from more than one ancestor class. However, using the implements function it is
possible to implement multiple interfaces. The porganization class
and the pperson class for example, share the 'address'
interface, though one does not inherit from the other. This means that a number
of variables, functions and templates are available in both classes.
You can also search for objects that implement a certain interface via the
object.implements property.

