Trait PrototypeTrait
A trait for classes wishing to implement prototype methods.
-
ICanBoogie\PrototypeTrait
uses
ICanBoogie\Accessor\AccessorTrait (not available)
Namespace: ICanBoogie
Located at PrototypeTrait.php
Methods summary
public
__call( string $method
, array $arguments
)
: mixed
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
has_property( string $property
)
: boolean
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
has_method( string $method
)
: boolean
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
get_prototype( void )
: ICanBoogie\Prototype
Returns the prototype associated with the class.
Returns the prototype associated with the class.
Returns
protected
accessor_get( $property
)
protected
accessor_set( $property
, $value
)
protected
last_chance_get( string $property
, boolean & $success
)
: mixed
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.
Properties summary
Magic properties