| Total Complexity | 4 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | class JxnCall extends AbstractCall |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * The Jaxon function prefix |
||
| 23 | * |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | protected $sPrefix; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * The constructor. |
||
| 30 | * |
||
| 31 | * @param DialogCommand $xDialog |
||
| 32 | * @param string $sPrefix |
||
| 33 | */ |
||
| 34 | public function __construct(DialogCommand $xDialog, string $sPrefix) |
||
| 35 | { |
||
| 36 | $this->xDialog = $xDialog; |
||
| 37 | $this->sPrefix = $sPrefix; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Create a js expression |
||
| 42 | * |
||
| 43 | * @return JsExpr |
||
| 44 | */ |
||
| 45 | protected function _expr(): JsExpr |
||
| 46 | { |
||
| 47 | return new JsExpr($this->xDialog); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Add a call to a js function on the current object |
||
| 52 | * |
||
| 53 | * @param string $sMethod |
||
| 54 | * @param array $aArguments |
||
| 55 | * |
||
| 56 | * @return JsExpr |
||
| 57 | */ |
||
| 58 | public function __call(string $sMethod, array $aArguments): JsExpr |
||
| 59 | { |
||
| 60 | // Append the prefix to the method name |
||
| 61 | return parent::__call($this->sPrefix . $sMethod, $aArguments); |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Get the js class name |
||
| 66 | * |
||
| 67 | * @return string |
||
| 68 | */ |
||
| 69 | public function _class(): string |
||
| 72 | } |
||
| 73 | } |
||
| 74 |