/** * * @param string $name * @param closure $newMethod */ public function __construct($name, $newMethod) { Args::isString($name, 'name'); Args::callBackArgs($newMethod, 1, 'newMethod'); $this->name = $name; $this->newMethod = new SerializableClosure($newMethod); }
/** * * @param closure $callback */ public function notify($callback) { Args::callBackArgs($callback, 1, 'callback'); foreach ($this->listeners as $listener) { $callback($listener); } }
public function __construct($id, $callback, $callDecorator = null) { parent::__construct($id); Args::callBackArgs($callback, 1, 'callback'); $this->eventBehaviour = new AjaxEventBehaviour('onclick', $callback); $this->add($this->eventBehaviour); $this->callback = $callback; }
public function __construct($event, $callback) { parent::__construct(); Args::isString($event, 'event'); Args::callBackArgs($callback, 1, 'callback'); $this->event = $event; $this->callback = $callback; }
/** * * @param Tab $tab * @param closure $newMethod */ public function addTab($tab, $newMethod = null) { if ($tab instanceof Tab) { array_push($this->tabs, $tab); } else { Args::isString($tab, 'tab'); Args::callBackArgs($newMethod, 1, 'newMethod'); array_push($this->tabs, new Tab($tab, $newMethod)); } }
public function __construct($id, $columnId, $columns, $callback = null, $model = null) { parent::__construct($id, $model); if ($callback != null) { Args::callBackArgs($callback, 1, 'callback'); } $this->columns = $columns; $this->columnId = $columnId; $this->callback = $callback; }
/** * * @param closure $valueCallable * @param closure $displayCallable */ public function __construct($valueCallable = null, $displayCallable = null) { if ($valueCallable != null) { Args::callBackArgs($valueCallable, 2, 'valueCallable'); } if ($displayCallable != null) { Args::callBackArgs($displayCallable, 2, 'displayCallable'); } $this->displayCallable = $displayCallable; $this->valueCallable = $valueCallable; }
/** * * @param type $name * @param type $function * @param ... args the names of the arguments the javascript function should take */ public function __construct($name, $callback, $function) { parent::__construct($name); Args::isString($function, 'function'); Args::callBackArgs($callback, 1, 'callback'); $this->callback = new SerializableClosure($callback); $this->function = $function; $args = func_get_args(); for ($i = 3; $i < count($args); $i++) { array_push($this->args, $args[$i]); } }
/** * * @param closure $decorator * @param closure $successDecorator * @param closure $failDecorator */ public function __construct($decorator, $successDecorator = null, $failDecorator = null) { Args::callBackArgs($decorator, 1, 'decorator'); if ($successDecorator != null) { Args::callBackArgs($successDecorator, 1, 'successDecorator'); } if ($failDecorator != null) { Args::callBackArgs($failDecorator, 1, 'failDecorator'); } $this->decorator = $decorator; $this->successDecorator = $successDecorator; $this->failDecorator = $failDecorator; }
/** * * @param string $id * @param array $choices * @param Model $model */ public function __construct($id, $choices, ChoiceRenderer $choiceRenderer = null, Model $model = null, $isDisabled = null) { parent::__construct($id, $model); Args::isArray($choices, 'choices'); $this->choices = $choices; if ($choiceRenderer == null) { $choiceRenderer = new ChoiceRenderer(); } $this->choiceRenderer = $choiceRenderer; if ($isDisabled != null) { Args::callBackArgs($isDisabled, 2, 'isDisabled'); $this->isDisabled = $isDisabled; } }
public function __construct($event, $onEvent, $onSubmit, $onError) { Args::callBackArgs($onEvent, 1, 'onEvent'); if ($onSubmit != null) { Args::callBackArgs($onSubmit, 1, 'onSubmit'); } if ($onError != null) { Args::callBackArgs($onError, 1, 'onError'); } $self = $this; parent::__construct($event, function ($target) use($self, $onEvent, $onSubmit, $onError) { $formComponent = $self->getComponent(); $formComponent->processInput(); $onEvent($target); if ($formComponent->isValid() && $onSubmit != null) { $onSubmit($target); } if (!$formComponent->isValid() && $onError != null) { $onError($target); } }); }
public function __construct($event, $onSubmit = null, $onError = null, $form = null) { $self = $this; parent::__construct($event, function ($target) use($self) { $self->setAjaxRequestTarget($target); $self->getForm()->process($self); }); if ($onSubmit != null) { Args::callBackArgs($onSubmit, 1, 'onSubmit'); } if ($onError != null) { Args::callBackArgs($onError, 1, 'onError'); } $this->onSubmit = $onSubmit; $this->onError = $onError; if ($form != null) { if ($form instanceof Form) { $this->form = $form; } else { throw new \InvalidArgumentException('$form must be an instance of Form'); } } }
public function __construct($heading, $callback) { Args::callBackArgs($callback, 2, 'callback'); $this->callback = $callback; }
/** * Recursivly visit all child components matching the Identifier and execute * a callback on each * @param Identifier $identifier * @param closure $callback */ public function visitChildren(Identifier $identifier, $callback) { Args::callBackArgs($callback, 1, 'callback'); $this->internalVisitChildren($identifier, $this->getChildren(), $callback); }
/** * * @param String $id * @param closure $callback * @param Model $model optional */ public function __construct($id, $callback, $model = null) { parent::__construct($id, $model); Args::callBackArgs($callback, 1, 'callback'); $this->callback = $callback; }
public function setBeforeClose($beforeClose, $function = '') { Args::callBackArgs($beforeClose, 1, 'beforeClose'); $this->getOptions()->add(new CallbackFunctionOption('beforeClose', $beforeClose, $function)); }
public function setRenderHeadCallback($renderHeadCallback) { Args::callBackArgs($renderHeadCallback, 2, 'renderHeadCallback'); $this->renderHeadCallback = $renderHeadCallback; }
public function setStopCallback($stopCallback, $jsCode = '') { Args::callBackArgs($stopCallback, 1, 'stopCallback'); $this->getOptions()->add(new CallbackFunctionOption('stop', $stopCallback, $jsCode, 'event', 'ui')); }