ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
JavaScriptBindable.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2016 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
15  private $on_load_code_binder = null;
16 
20  public function withOnLoadCode(\Closure $binder) {
21  $this->checkBinder($binder);
22  $clone = clone $this;
23  $clone->on_load_code_binder = $binder;
24  return $clone;
25  }
26 
30  public function getOnLoadCode() {
31  return $this->on_load_code_binder;
32  }
33 
39  private function checkBinder(\Closure $binder) {
40  $refl = new \ReflectionFunction($binder);
41  $args = array_map(function($arg) { return $arg->name; }, $refl->getParameters());
42  if (array("id") !== $args) {
43  throw new \InvalidArgumentException('Expected closure "$binder" to have exactly one argument "$id".');
44  }
45  }
46 }
Create styles array
The data for the language used.