DynamicMethodTrait¶
-
trait
atk4\core\
DynamicMethodTrait
¶ - This trait makes it possible for you to add dynamic methodsinto your object.
Source: vendor/atk4/core/src/DynamicMethodTrait.php#9
Properties¶
-
public static property
atk4\core\DynamicMethodTrait::$
_dynamicMethodTrait
¶ - Check this property to see if trait is present in the object.
Source: vendor/atk4/core/src/DynamicMethodTrait.php#16 Type: bool
Methods¶
-
public
atk4\core\DynamicMethodTrait::
__call
($method, $arguments)¶ - Magic method - tries to call dynamic method and throws exception ifthis was not possible.
Source: Parameters: - $arguments (array) Array of arguments to pass to this method
-
public
atk4\core\DynamicMethodTrait::
tryCall
($method, $arguments)¶ - Tries to call dynamic method.
Source: Parameters: - $arguments (array) Array of arguments to pass to this method
Returns: mixed | null
-
public
atk4\core\DynamicMethodTrait::
addMethod
($name, $callable)¶ - Add new method for this object.
Source: Parameters: - $name (string | array) Name of new method of $this object
- $callable (callable) Callback
Returns: $this
-
public
atk4\core\DynamicMethodTrait::
hasMethod
($name)¶ - Return if this object has specified method (either native or dynamic).
Source: Parameters: - $name (string) Name of the method
Returns: bool
-
public
atk4\core\DynamicMethodTrait::
removeMethod
($name)¶ - Remove dynamically registered method.
Source: Parameters: - $name (string) Name of the method
Returns: $this
-
public
atk4\core\DynamicMethodTrait::
addGlobalMethod
($name, $callable)¶ - Agile Toolkit objects allow method injection. This is quite similarto technique used in JavaScript:.obj.test = function() { .. }All non-existent method calls on all Agile Toolkit objects will betried against local table of registered methods and then againstglobal registered methods.addGlobalMethod allows you to register a globally-recognized method forall Agile Toolkit objects. PHP is not particularly fast about executingmethods like that, but this technique can be used for addingbackward-compatibility or debugging, etc.
Source: Parameters: - $name (string) Name of the method
- $callable (callable) Calls your function($object, $arg1, $arg2)
See: \atk4\core\self::hasMethod()
See: \atk4\core\self::hasMethod()
-
public
atk4\core\DynamicMethodTrait::
hasGlobalMethod
($name)¶ - Return true if such global method exists.
Source: Parameters: - $name (string) Name of the method
Returns: bool
-
public
atk4\core\DynamicMethodTrait::
removeGlobalMethod
($name)¶ - Remove dynamically registered global method.
Source: Parameters: - $name (string) Name of the method
Returns: $this