Definition at line 10 of file Callback.php.
◆ __construct()
__construct |
( |
|
$callable, |
|
|
|
$arguments = null , |
|
|
|
$createInstance = false |
|
) |
| |
Create callback
- Parameters
-
callable | $callable | |
mixed | $arguments | |
bool | $createInstance | If true than $callable[0] will be evaluated to new instance of class when get value |
Definition at line 34 of file Callback.php.
36 $this->_callable = $callable;
38 $this->_createInstance = $createInstance;
setArguments($arguments=null)
◆ getValue()
Get callback value
- Returns
- mixed
- Exceptions
-
Implements OptionInterface.
Definition at line 64 of file Callback.php.
68 if (is_array($callable) && isset($callable[0]) && is_string($callable[0])) {
70 throw new \InvalidArgumentException(sprintf(
'Class "%s" was not found', $callable[0]));
72 if ($this->_createInstance) {
73 $callable[0] =
new $callable[0]();
75 }
elseif ($this->_createInstance) {
76 throw new \InvalidArgumentException(
'Callable expected to be an array with class name as first element');
79 if (!is_callable($callable)) {
80 throw new \InvalidArgumentException(
'Callback does not callable');
83 if ($this->_arguments) {
84 return call_user_func_array($callable, $this->_arguments);
elseif(isset( $params[ 'redirect_parent']))
call_user_func($callable, $param)
◆ setArguments()
setArguments |
( |
|
$arguments = null | ) |
|
Set callback arguments
- Parameters
-
- Returns
- void
Definition at line 47 of file Callback.php.
54 $this->_arguments =
null;
elseif(isset( $params[ 'redirect_parent']))
◆ $_arguments
◆ $_callable
◆ $_createInstance
The documentation for this class was generated from the following file:
- vendor/magento/framework/Validator/Constraint/Option/Callback.php