10 class Callback implements \Magento\Framework\Validator\Constraint\OptionInterface
36 $this->_callable = $callable;
38 $this->_createInstance = $createInstance;
54 $this->_arguments =
null;
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)
__construct($callable, $arguments=null, $createInstance=false)
setArguments($arguments=null)