Trait PrototypeTrait
A trait for classes wishing to implement prototype methods.
-
ICanBoogie\PrototypeTrait
uses
ICanBoogie\Accessor\AccessorTrait (not available)
Methods summary
public
mixed
|
#
__call( string $method, array $arguments )
If a property exists with the name specified by $method and holds an object which class
implements __invoke then the object is called with the arguments. Otherwise, calls are
forwarded to the $prototype.
If a property exists with the name specified by $method and holds an object which class
implements __invoke then the object is called with the arguments. Otherwise, calls are
forwarded to the $prototype.
Parameters
Returns
mixed
|
public
boolean
|
#
has_property( string $property )
Checks if the object has the specified property.
Checks if the object has the specified property.
The difference with the property_exists() function is that this method also checks for
getters defined by the class or the prototype.
Parameters
- $property
- The property to check.
Returns
boolean true if the object has the property, false otherwise.
|
public
boolean
|
#
has_method( string $method )
Checks whether this object supports the specified method.
Checks whether this object supports the specified method.
The method checks for methods defined by the class and the prototype.
Parameters
- $method
- Name of the method.
Returns
boolean
true if the method is defined, false otherwise.
|
protected
ICanBoogie\Prototype
|
#
get_prototype( )
Returns the prototype associated with the class.
Returns the prototype associated with the class.
Returns
|
protected
|
|
protected
|
|
protected
mixed
|
#
last_chance_get( string $property, boolean & $success )
The method is invoked as a last chance to get a property,
just before an exception is thrown.
The method is invoked as a last chance to get a property,
just before an exception is thrown.
Parameters
- $property
- Property to get.
- $success
- If the last chance get was successful.
Returns
mixed
|
protected
|
#
last_chance_set( string $property, mixed $value, boolean & $success )
The method is invoked as a last chance to set a property,
just before an exception is thrown.
The method is invoked as a last chance to set a property,
just before an exception is thrown.
Parameters
- $property
- Property to set.
- $value
- Value of the property.
- $success
- If the last chance set was successful.
|