@@ -7,53 +7,53 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Func extends TypedValue |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * The constructor. |
| 12 | 12 | * |
| 13 | 13 | * @param string $sName The method name |
| 14 | 14 | * @param array $aArguments The method arguments |
| 15 | 15 | */ |
| 16 | - public function __construct(private string $sName, private array $aArguments) |
|
| 17 | - {} |
|
| 16 | +public function __construct(private string $sName, private array $aArguments) |
|
| 17 | +{} |
|
| 18 | 18 | |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @inheritDoc |
| 21 | 21 | */ |
| 22 | - public function getType(): string |
|
| 23 | - { |
|
| 24 | - return 'func'; |
|
| 25 | - } |
|
| 22 | +public function getType(): string |
|
| 23 | +{ |
|
| 24 | +return 'func'; |
|
| 25 | +} |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * Add the page number to the function arguments. |
| 29 | 29 | * |
| 30 | 30 | * @return self |
| 31 | 31 | */ |
| 32 | - public function withPage(): self |
|
| 33 | - { |
|
| 34 | - foreach($this->aArguments as $xArgument) |
|
| 35 | - { |
|
| 36 | - if(TypedValue::isPage($xArgument)) |
|
| 37 | - { |
|
| 38 | - return $this; |
|
| 39 | - } |
|
| 40 | - } |
|
| 41 | - $this->aArguments[] = TypedValue::page(); |
|
| 42 | - return $this; |
|
| 43 | - } |
|
| 32 | +public function withPage(): self |
|
| 33 | +{ |
|
| 34 | +foreach($this->aArguments as $xArgument) |
|
| 35 | +{ |
|
| 36 | +if(TypedValue::isPage($xArgument)) |
|
| 37 | +{ |
|
| 38 | + return $this; |
|
| 39 | +} |
|
| 40 | +} |
|
| 41 | +$this->aArguments[] = TypedValue::page(); |
|
| 42 | +return $this; |
|
| 43 | +} |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | +/** |
|
| 46 | 46 | * Convert this call to array, when converting the response into json. |
| 47 | 47 | * |
| 48 | 48 | * @return array |
| 49 | 49 | */ |
| 50 | - public function jsonSerialize(): array |
|
| 51 | - { |
|
| 52 | - return [ |
|
| 53 | - '_type' => $this->getType(), |
|
| 54 | - '_name' => $this->sName, |
|
| 55 | - 'args' => array_map(fn(mixed $xArgument) => |
|
| 56 | - TypedValue::make($xArgument)->jsonSerialize(), $this->aArguments), |
|
| 57 | - ]; |
|
| 58 | - } |
|
| 50 | +public function jsonSerialize(): array |
|
| 51 | +{ |
|
| 52 | +return [ |
|
| 53 | +'_type' => $this->getType(), |
|
| 54 | +'_name' => $this->sName, |
|
| 55 | +'args' => array_map(fn(mixed $xArgument) => |
|
| 56 | + TypedValue::make($xArgument)->jsonSerialize(), $this->aArguments), |
|
| 57 | +]; |
|
| 58 | +} |
|
| 59 | 59 | } |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function withPage(): self |
| 33 | 33 | { |
| 34 | - foreach($this->aArguments as $xArgument) |
|
| 34 | + foreach ($this->aArguments as $xArgument) |
|
| 35 | 35 | { |
| 36 | - if(TypedValue::isPage($xArgument)) |
|
| 36 | + if (TypedValue::isPage($xArgument)) |
|
| 37 | 37 | { |
| 38 | 38 | return $this; |
| 39 | 39 | } |
@@ -4,38 +4,38 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | class Attr extends TypedValue |
| 6 | 6 | { |
| 7 | - /** |
|
| 7 | +/** |
|
| 8 | 8 | * The constructor |
| 9 | 9 | * |
| 10 | 10 | * @param array $aValue |
| 11 | 11 | */ |
| 12 | - public function __construct(private array $aValue) |
|
| 13 | - {} |
|
| 12 | +public function __construct(private array $aValue) |
|
| 13 | +{} |
|
| 14 | 14 | |
| 15 | - /** |
|
| 15 | +/** |
|
| 16 | 16 | * @inheritDoc |
| 17 | 17 | */ |
| 18 | - public function getType(): string |
|
| 19 | - { |
|
| 20 | - return $this->aValue['_type'] ?? '_'; |
|
| 21 | - } |
|
| 18 | +public function getType(): string |
|
| 19 | +{ |
|
| 20 | +return $this->aValue['_type'] ?? '_'; |
|
| 21 | +} |
|
| 22 | 22 | |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * Create an abject to get the value of an attribute |
| 25 | 25 | * |
| 26 | 26 | * @param string $sAttrName The attribute name |
| 27 | 27 | * |
| 28 | 28 | * @return Attr |
| 29 | 29 | */ |
| 30 | - public static function get(string $sAttrName): Attr |
|
| 31 | - { |
|
| 32 | - return new Attr([ |
|
| 33 | - '_type' => 'attr', |
|
| 34 | - '_name' => $sAttrName, |
|
| 35 | - ]); |
|
| 36 | - } |
|
| 30 | +public static function get(string $sAttrName): Attr |
|
| 31 | +{ |
|
| 32 | +return new Attr([ |
|
| 33 | +'_type' => 'attr', |
|
| 34 | +'_name' => $sAttrName, |
|
| 35 | +]); |
|
| 36 | +} |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * Create an abject to set the value of an attribute |
| 40 | 40 | * |
| 41 | 41 | * @param string $sAttrName The attribute name |
@@ -43,22 +43,22 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return Attr |
| 45 | 45 | */ |
| 46 | - public static function set(string $sAttrName, $xAttrValue): Attr |
|
| 47 | - { |
|
| 48 | - return new Attr([ |
|
| 49 | - '_type' => 'attr', |
|
| 50 | - '_name' => $sAttrName, |
|
| 51 | - 'value' => TypedValue::make($xAttrValue)->jsonSerialize(), |
|
| 52 | - ]); |
|
| 53 | - } |
|
| 46 | +public static function set(string $sAttrName, $xAttrValue): Attr |
|
| 47 | +{ |
|
| 48 | +return new Attr([ |
|
| 49 | +'_type' => 'attr', |
|
| 50 | +'_name' => $sAttrName, |
|
| 51 | +'value' => TypedValue::make($xAttrValue)->jsonSerialize(), |
|
| 52 | +]); |
|
| 53 | +} |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | +/** |
|
| 56 | 56 | * Convert this call to array, when converting the response into json. |
| 57 | 57 | * |
| 58 | 58 | * @return array |
| 59 | 59 | */ |
| 60 | - public function jsonSerialize(): array |
|
| 61 | - { |
|
| 62 | - return $this->aValue; |
|
| 63 | - } |
|
| 60 | +public function jsonSerialize(): array |
|
| 61 | +{ |
|
| 62 | +return $this->aValue; |
|
| 63 | +} |
|
| 64 | 64 | } |
@@ -19,36 +19,36 @@ |
||
| 19 | 19 | |
| 20 | 20 | abstract class TypedValue implements JsonSerializable |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @return string |
| 24 | 24 | */ |
| 25 | - abstract public function getType(): string; |
|
| 25 | +abstract public function getType(): string; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * @param mixed $xValue |
| 29 | 29 | * |
| 30 | 30 | * @return TypedValue |
| 31 | 31 | */ |
| 32 | - public static function make(mixed $xValue): TypedValue |
|
| 33 | - { |
|
| 34 | - return $xValue instanceof TypedValue ? $xValue : new SimpleValue($xValue); |
|
| 35 | - } |
|
| 32 | +public static function make(mixed $xValue): TypedValue |
|
| 33 | +{ |
|
| 34 | +return $xValue instanceof TypedValue ? $xValue : new SimpleValue($xValue); |
|
| 35 | +} |
|
| 36 | 36 | |
| 37 | - /** |
|
| 37 | +/** |
|
| 38 | 38 | * @return PageValue |
| 39 | 39 | */ |
| 40 | - public static function page(): PageValue |
|
| 41 | - { |
|
| 42 | - return new PageValue(); |
|
| 43 | - } |
|
| 40 | +public static function page(): PageValue |
|
| 41 | +{ |
|
| 42 | +return new PageValue(); |
|
| 43 | +} |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | +/** |
|
| 46 | 46 | * @param mixed $xValue |
| 47 | 47 | * |
| 48 | 48 | * @return bool |
| 49 | 49 | */ |
| 50 | - public static function isPage(mixed $xValue): bool |
|
| 51 | - { |
|
| 52 | - return is_a($xValue, PageValue::class); |
|
| 53 | - } |
|
| 50 | +public static function isPage(mixed $xValue): bool |
|
| 51 | +{ |
|
| 52 | +return is_a($xValue, PageValue::class); |
|
| 53 | +} |
|
| 54 | 54 | } |
@@ -16,59 +16,59 @@ |
||
| 16 | 16 | |
| 17 | 17 | class HtmlReader |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * The class constructor |
| 21 | 21 | * |
| 22 | 22 | * @param string $sElementId |
| 23 | 23 | */ |
| 24 | - public function __construct(private string $sElementId = '') |
|
| 25 | - {} |
|
| 24 | +public function __construct(private string $sElementId = '') |
|
| 25 | +{} |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * @return array |
| 29 | 29 | */ |
| 30 | - public function form(): array |
|
| 31 | - { |
|
| 32 | - return ['_type' => 'form', '_name' => $this->sElementId]; |
|
| 33 | - } |
|
| 30 | +public function form(): array |
|
| 31 | +{ |
|
| 32 | +return ['_type' => 'form', '_name' => $this->sElementId]; |
|
| 33 | +} |
|
| 34 | 34 | |
| 35 | - /** |
|
| 35 | +/** |
|
| 36 | 36 | * @return array |
| 37 | 37 | */ |
| 38 | - public function checked(): array |
|
| 39 | - { |
|
| 40 | - return ['_type' => 'checked', '_name' => $this->sElementId]; |
|
| 41 | - } |
|
| 38 | +public function checked(): array |
|
| 39 | +{ |
|
| 40 | +return ['_type' => 'checked', '_name' => $this->sElementId]; |
|
| 41 | +} |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * @return HtmlValue |
| 45 | 45 | */ |
| 46 | - public function input(): HtmlValue |
|
| 47 | - { |
|
| 48 | - return new HtmlValue(['_type' => 'input', '_name' => $this->sElementId]); |
|
| 49 | - } |
|
| 46 | +public function input(): HtmlValue |
|
| 47 | +{ |
|
| 48 | +return new HtmlValue(['_type' => 'input', '_name' => $this->sElementId]); |
|
| 49 | +} |
|
| 50 | 50 | |
| 51 | - /** |
|
| 51 | +/** |
|
| 52 | 52 | * @return HtmlValue |
| 53 | 53 | */ |
| 54 | - public function select(): HtmlValue |
|
| 55 | - { |
|
| 56 | - return $this->input(); |
|
| 57 | - } |
|
| 54 | +public function select(): HtmlValue |
|
| 55 | +{ |
|
| 56 | +return $this->input(); |
|
| 57 | +} |
|
| 58 | 58 | |
| 59 | - /** |
|
| 59 | +/** |
|
| 60 | 60 | * @return HtmlValue |
| 61 | 61 | */ |
| 62 | - public function html(): HtmlValue |
|
| 63 | - { |
|
| 64 | - return new HtmlValue(['_type' => 'html', '_name' => $this->sElementId]); |
|
| 65 | - } |
|
| 62 | +public function html(): HtmlValue |
|
| 63 | +{ |
|
| 64 | +return new HtmlValue(['_type' => 'html', '_name' => $this->sElementId]); |
|
| 65 | +} |
|
| 66 | 66 | |
| 67 | - /** |
|
| 67 | +/** |
|
| 68 | 68 | * @return PageValue |
| 69 | 69 | */ |
| 70 | - public function page(): PageValue |
|
| 71 | - { |
|
| 72 | - return TypedValue::page(); |
|
| 73 | - } |
|
| 70 | +public function page(): PageValue |
|
| 71 | +{ |
|
| 72 | +return TypedValue::page(); |
|
| 73 | +} |
|
| 74 | 74 | } |
@@ -9,36 +9,36 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Selector implements JsonSerializable |
| 11 | 11 | { |
| 12 | - /** |
|
| 12 | +/** |
|
| 13 | 13 | * @var array |
| 14 | 14 | */ |
| 15 | - private $aCall; |
|
| 15 | +private $aCall; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * The constructor. |
| 19 | 19 | * |
| 20 | 20 | * @param string $sMode The selector mode: 'jq' or 'js' |
| 21 | 21 | * @param string $sPath The selector path |
| 22 | 22 | * @param mixed $xContext A context associated to the selector |
| 23 | 23 | */ |
| 24 | - public function __construct(string $sMode, string $sPath, $xContext = null) |
|
| 25 | - { |
|
| 26 | - $sName = trim($sPath) ?: 'this'; |
|
| 27 | - $this->aCall = ['_type' => 'select', '_name' => $sName, 'mode' => $sMode]; |
|
| 28 | - if($sName !== 'this' && $xContext !== null) |
|
| 29 | - { |
|
| 30 | - $this->aCall['context'] = is_a($xContext, JsonSerializable::class) ? |
|
| 31 | - $xContext->jsonSerialize() : $xContext; |
|
| 32 | - } |
|
| 33 | - } |
|
| 24 | +public function __construct(string $sMode, string $sPath, $xContext = null) |
|
| 25 | +{ |
|
| 26 | +$sName = trim($sPath) ?: 'this'; |
|
| 27 | +$this->aCall = ['_type' => 'select', '_name' => $sName, 'mode' => $sMode]; |
|
| 28 | +if($sName !== 'this' && $xContext !== null) |
|
| 29 | +{ |
|
| 30 | +$this->aCall['context'] = is_a($xContext, JsonSerializable::class) ? |
|
| 31 | + $xContext->jsonSerialize() : $xContext; |
|
| 32 | +} |
|
| 33 | +} |
|
| 34 | 34 | |
| 35 | - /** |
|
| 35 | +/** |
|
| 36 | 36 | * Convert this call to array, when converting the response into json. |
| 37 | 37 | * |
| 38 | 38 | * @return array |
| 39 | 39 | */ |
| 40 | - public function jsonSerialize(): array |
|
| 41 | - { |
|
| 42 | - return $this->aCall; |
|
| 43 | - } |
|
| 40 | +public function jsonSerialize(): array |
|
| 41 | +{ |
|
| 42 | +return $this->aCall; |
|
| 43 | +} |
|
| 44 | 44 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $sName = trim($sPath) ?: 'this'; |
| 27 | 27 | $this->aCall = ['_type' => 'select', '_name' => $sName, 'mode' => $sMode]; |
| 28 | - if($sName !== 'this' && $xContext !== null) |
|
| 28 | + if ($sName !== 'this' && $xContext !== null) |
|
| 29 | 29 | { |
| 30 | 30 | $this->aCall['context'] = is_a($xContext, JsonSerializable::class) ? |
| 31 | 31 | $xContext->jsonSerialize() : $xContext; |
@@ -29,77 +29,77 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | class JsExpr extends TypedValue implements Stringable |
| 31 | 31 | { |
| 32 | - /** |
|
| 32 | +/** |
|
| 33 | 33 | * The actions to be applied on the selected element |
| 34 | 34 | * |
| 35 | 35 | * @var array |
| 36 | 36 | */ |
| 37 | - protected $aCalls = []; |
|
| 37 | +protected $aCalls = []; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 39 | +/** |
|
| 40 | 40 | * The arguments of the else() calls |
| 41 | 41 | * |
| 42 | 42 | * @var array |
| 43 | 43 | */ |
| 44 | - protected $aAlert = []; |
|
| 44 | +protected $aAlert = []; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 46 | +/** |
|
| 47 | 47 | * A condition to check before making the call |
| 48 | 48 | * |
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | - protected $aCondition = []; |
|
| 51 | +protected $aCondition = []; |
|
| 52 | 52 | |
| 53 | - /** |
|
| 53 | +/** |
|
| 54 | 54 | * The arguments of the confirm() call |
| 55 | 55 | * |
| 56 | 56 | * @var array |
| 57 | 57 | */ |
| 58 | - protected $aConfirm = []; |
|
| 58 | +protected $aConfirm = []; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 60 | +/** |
|
| 61 | 61 | * @param DialogCommand |
| 62 | 62 | */ |
| 63 | - private static DialogCommand $xDialogCommand; |
|
| 63 | +private static DialogCommand $xDialogCommand; |
|
| 64 | 64 | |
| 65 | - /** |
|
| 65 | +/** |
|
| 66 | 66 | * The constructor |
| 67 | 67 | */ |
| 68 | - public function __construct(...$aCalls) |
|
| 69 | - { |
|
| 70 | - $this->aCalls = $aCalls; |
|
| 71 | - } |
|
| 68 | +public function __construct(...$aCalls) |
|
| 69 | +{ |
|
| 70 | +$this->aCalls = $aCalls; |
|
| 71 | +} |
|
| 72 | 72 | |
| 73 | - /** |
|
| 73 | +/** |
|
| 74 | 74 | * Set the dialog command |
| 75 | 75 | * |
| 76 | 76 | * @param DialogCommand $xDialogCommand |
| 77 | 77 | * |
| 78 | 78 | * @return void |
| 79 | 79 | */ |
| 80 | - public static function setDialogCommand(DialogCommand $xDialogCommand): void |
|
| 81 | - { |
|
| 82 | - self::$xDialogCommand = $xDialogCommand; |
|
| 83 | - } |
|
| 80 | +public static function setDialogCommand(DialogCommand $xDialogCommand): void |
|
| 81 | +{ |
|
| 82 | +self::$xDialogCommand = $xDialogCommand; |
|
| 83 | +} |
|
| 84 | 84 | |
| 85 | - /** |
|
| 85 | +/** |
|
| 86 | 86 | * Get the first function in the calls |
| 87 | 87 | * |
| 88 | 88 | * @return Func|null |
| 89 | 89 | */ |
| 90 | - public function func(): ?Func |
|
| 91 | - { |
|
| 92 | - foreach($this->aCalls as $xCall) |
|
| 93 | - { |
|
| 94 | - if(is_a($xCall, Func::class)) |
|
| 95 | - { |
|
| 96 | - return $xCall; |
|
| 97 | - } |
|
| 98 | - } |
|
| 99 | - return null; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 90 | +public function func(): ?Func |
|
| 91 | +{ |
|
| 92 | +foreach($this->aCalls as $xCall) |
|
| 93 | +{ |
|
| 94 | +if(is_a($xCall, Func::class)) |
|
| 95 | +{ |
|
| 96 | + return $xCall; |
|
| 97 | +} |
|
| 98 | +} |
|
| 99 | +return null; |
|
| 100 | +} |
|
| 101 | + |
|
| 102 | +/** |
|
| 103 | 103 | * Add a call to a js function on the current object |
| 104 | 104 | * |
| 105 | 105 | * @param string $sMethod |
@@ -107,28 +107,28 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @return self |
| 109 | 109 | */ |
| 110 | - public function __call(string $sMethod, array $aArguments): self |
|
| 111 | - { |
|
| 112 | - // Append the action into the array |
|
| 113 | - $this->aCalls[] = new Func($sMethod, $aArguments); |
|
| 114 | - return $this; |
|
| 115 | - } |
|
| 110 | +public function __call(string $sMethod, array $aArguments): self |
|
| 111 | +{ |
|
| 112 | +// Append the action into the array |
|
| 113 | +$this->aCalls[] = new Func($sMethod, $aArguments); |
|
| 114 | +return $this; |
|
| 115 | +} |
|
| 116 | 116 | |
| 117 | - /** |
|
| 117 | +/** |
|
| 118 | 118 | * Get the value of an attribute of the current object |
| 119 | 119 | * |
| 120 | 120 | * @param string $sAttribute |
| 121 | 121 | * |
| 122 | 122 | * @return self |
| 123 | 123 | */ |
| 124 | - public function __get(string $sAttribute): self |
|
| 125 | - { |
|
| 126 | - // Append the action into the array |
|
| 127 | - $this->aCalls[] = Attr::get($sAttribute); |
|
| 128 | - return $this; |
|
| 129 | - } |
|
| 124 | +public function __get(string $sAttribute): self |
|
| 125 | +{ |
|
| 126 | +// Append the action into the array |
|
| 127 | +$this->aCalls[] = Attr::get($sAttribute); |
|
| 128 | +return $this; |
|
| 129 | +} |
|
| 130 | 130 | |
| 131 | - /** |
|
| 131 | +/** |
|
| 132 | 132 | * Set the value of an attribute of the current object |
| 133 | 133 | * |
| 134 | 134 | * @param string $sAttribute |
@@ -136,14 +136,14 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | * @return void |
| 138 | 138 | */ |
| 139 | - public function __set(string $sAttribute, $xValue) |
|
| 140 | - { |
|
| 141 | - // Append the action into the array |
|
| 142 | - $this->aCalls[] = Attr::set($sAttribute, $xValue); |
|
| 143 | - return $this; |
|
| 144 | - } |
|
| 139 | +public function __set(string $sAttribute, $xValue) |
|
| 140 | +{ |
|
| 141 | +// Append the action into the array |
|
| 142 | +$this->aCalls[] = Attr::set($sAttribute, $xValue); |
|
| 143 | +return $this; |
|
| 144 | +} |
|
| 145 | 145 | |
| 146 | - /** |
|
| 146 | +/** |
|
| 147 | 147 | * Set an event handler on the selected elements |
| 148 | 148 | * |
| 149 | 149 | * @param string $sMode The event mode: 'jq' or 'js' |
@@ -152,13 +152,13 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @return self |
| 154 | 154 | */ |
| 155 | - public function event(string $sMode, string $sName, JsExpr $xHandler): self |
|
| 156 | - { |
|
| 157 | - $this->aCalls[] = new Event($sMode, $sName, $xHandler); |
|
| 158 | - return $this; |
|
| 159 | - } |
|
| 155 | +public function event(string $sMode, string $sName, JsExpr $xHandler): self |
|
| 156 | +{ |
|
| 157 | +$this->aCalls[] = new Event($sMode, $sName, $xHandler); |
|
| 158 | +return $this; |
|
| 159 | +} |
|
| 160 | 160 | |
| 161 | - /** |
|
| 161 | +/** |
|
| 162 | 162 | * Show a message if the condition to the call is not met |
| 163 | 163 | * |
| 164 | 164 | * @param string $sMessage The message to show |
@@ -166,13 +166,13 @@ discard block |
||
| 166 | 166 | * |
| 167 | 167 | * @return self |
| 168 | 168 | */ |
| 169 | - public function elseShow(string $sMessage, ...$aArgs): self |
|
| 170 | - { |
|
| 171 | - $this->aAlert = self::$xDialogCommand->warning($sMessage, $aArgs); |
|
| 172 | - return $this; |
|
| 173 | - } |
|
| 169 | +public function elseShow(string $sMessage, ...$aArgs): self |
|
| 170 | +{ |
|
| 171 | +$this->aAlert = self::$xDialogCommand->warning($sMessage, $aArgs); |
|
| 172 | +return $this; |
|
| 173 | +} |
|
| 174 | 174 | |
| 175 | - /** |
|
| 175 | +/** |
|
| 176 | 176 | * Show an information message if the condition to the call is not met |
| 177 | 177 | * |
| 178 | 178 | * @param string $sMessage The message to show |
@@ -180,13 +180,13 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return self |
| 182 | 182 | */ |
| 183 | - public function elseInfo(string $sMessage, ...$aArgs): self |
|
| 184 | - { |
|
| 185 | - $this->aAlert = self::$xDialogCommand->info($sMessage, $aArgs); |
|
| 186 | - return $this; |
|
| 187 | - } |
|
| 183 | +public function elseInfo(string $sMessage, ...$aArgs): self |
|
| 184 | +{ |
|
| 185 | +$this->aAlert = self::$xDialogCommand->info($sMessage, $aArgs); |
|
| 186 | +return $this; |
|
| 187 | +} |
|
| 188 | 188 | |
| 189 | - /** |
|
| 189 | +/** |
|
| 190 | 190 | * Show a success message if the condition to the call is not met |
| 191 | 191 | * |
| 192 | 192 | * @param string $sMessage The message to show |
@@ -194,13 +194,13 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return self |
| 196 | 196 | */ |
| 197 | - public function elseSuccess(string $sMessage, ...$aArgs): self |
|
| 198 | - { |
|
| 199 | - $this->aAlert = self::$xDialogCommand->success($sMessage, $aArgs); |
|
| 200 | - return $this; |
|
| 201 | - } |
|
| 197 | +public function elseSuccess(string $sMessage, ...$aArgs): self |
|
| 198 | +{ |
|
| 199 | +$this->aAlert = self::$xDialogCommand->success($sMessage, $aArgs); |
|
| 200 | +return $this; |
|
| 201 | +} |
|
| 202 | 202 | |
| 203 | - /** |
|
| 203 | +/** |
|
| 204 | 204 | * Show a warning message if the condition to the call is not met |
| 205 | 205 | * |
| 206 | 206 | * @param string $sMessage The message to show |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @return self |
| 210 | 210 | */ |
| 211 | - public function elseWarning(string $sMessage, ...$aArgs): self |
|
| 212 | - { |
|
| 213 | - $this->aAlert = self::$xDialogCommand->warning($sMessage, $aArgs); |
|
| 214 | - return $this; |
|
| 215 | - } |
|
| 211 | +public function elseWarning(string $sMessage, ...$aArgs): self |
|
| 212 | +{ |
|
| 213 | +$this->aAlert = self::$xDialogCommand->warning($sMessage, $aArgs); |
|
| 214 | +return $this; |
|
| 215 | +} |
|
| 216 | 216 | |
| 217 | - /** |
|
| 217 | +/** |
|
| 218 | 218 | * Show an error message if the condition to the call is not met |
| 219 | 219 | * |
| 220 | 220 | * @param string $sMessage The message to show |
@@ -222,13 +222,13 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @return self |
| 224 | 224 | */ |
| 225 | - public function elseError(string $sMessage, ...$aArgs): self |
|
| 226 | - { |
|
| 227 | - $this->aAlert = self::$xDialogCommand->error($sMessage, $aArgs); |
|
| 228 | - return $this; |
|
| 229 | - } |
|
| 225 | +public function elseError(string $sMessage, ...$aArgs): self |
|
| 226 | +{ |
|
| 227 | +$this->aAlert = self::$xDialogCommand->error($sMessage, $aArgs); |
|
| 228 | +return $this; |
|
| 229 | +} |
|
| 230 | 230 | |
| 231 | - /** |
|
| 231 | +/** |
|
| 232 | 232 | * Add a confirmation question to the request |
| 233 | 233 | * |
| 234 | 234 | * @param string $sQuestion The question to ask |
@@ -236,13 +236,13 @@ discard block |
||
| 236 | 236 | * |
| 237 | 237 | * @return self |
| 238 | 238 | */ |
| 239 | - public function confirm(string $sQuestion, ...$aArgs): self |
|
| 240 | - { |
|
| 241 | - $this->aConfirm = self::$xDialogCommand->confirm($sQuestion, $aArgs); |
|
| 242 | - return $this; |
|
| 243 | - } |
|
| 239 | +public function confirm(string $sQuestion, ...$aArgs): self |
|
| 240 | +{ |
|
| 241 | +$this->aConfirm = self::$xDialogCommand->confirm($sQuestion, $aArgs); |
|
| 242 | +return $this; |
|
| 243 | +} |
|
| 244 | 244 | |
| 245 | - /** |
|
| 245 | +/** |
|
| 246 | 246 | * Check if a value is equal to another before sending the request |
| 247 | 247 | * |
| 248 | 248 | * @param mixed $xValue1 The first value to compare |
@@ -250,13 +250,13 @@ discard block |
||
| 250 | 250 | * |
| 251 | 251 | * @return self |
| 252 | 252 | */ |
| 253 | - public function ifeq($xValue1, $xValue2): self |
|
| 254 | - { |
|
| 255 | - $this->aCondition = ['eq', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 256 | - return $this; |
|
| 257 | - } |
|
| 253 | +public function ifeq($xValue1, $xValue2): self |
|
| 254 | +{ |
|
| 255 | +$this->aCondition = ['eq', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 256 | +return $this; |
|
| 257 | +} |
|
| 258 | 258 | |
| 259 | - /** |
|
| 259 | +/** |
|
| 260 | 260 | * Check if a value is equal to another before sending the request |
| 261 | 261 | * |
| 262 | 262 | * @param mixed $xValue1 The first value to compare |
@@ -264,13 +264,13 @@ discard block |
||
| 264 | 264 | * |
| 265 | 265 | * @return self |
| 266 | 266 | */ |
| 267 | - public function ifteq($xValue1, $xValue2): self |
|
| 268 | - { |
|
| 269 | - $this->aCondition = ['teq', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 270 | - return $this; |
|
| 271 | - } |
|
| 267 | +public function ifteq($xValue1, $xValue2): self |
|
| 268 | +{ |
|
| 269 | +$this->aCondition = ['teq', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 270 | +return $this; |
|
| 271 | +} |
|
| 272 | 272 | |
| 273 | - /** |
|
| 273 | +/** |
|
| 274 | 274 | * Check if a value is not equal to another before sending the request |
| 275 | 275 | * |
| 276 | 276 | * @param mixed $xValue1 The first value to compare |
@@ -278,13 +278,13 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @return self |
| 280 | 280 | */ |
| 281 | - public function ifne($xValue1, $xValue2): self |
|
| 282 | - { |
|
| 283 | - $this->aCondition = ['ne', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 284 | - return $this; |
|
| 285 | - } |
|
| 281 | +public function ifne($xValue1, $xValue2): self |
|
| 282 | +{ |
|
| 283 | +$this->aCondition = ['ne', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 284 | +return $this; |
|
| 285 | +} |
|
| 286 | 286 | |
| 287 | - /** |
|
| 287 | +/** |
|
| 288 | 288 | * Check if a value is not equal to another before sending the request |
| 289 | 289 | * |
| 290 | 290 | * @param mixed $xValue1 The first value to compare |
@@ -292,13 +292,13 @@ discard block |
||
| 292 | 292 | * |
| 293 | 293 | * @return self |
| 294 | 294 | */ |
| 295 | - public function ifnte($xValue1, $xValue2): self |
|
| 296 | - { |
|
| 297 | - $this->aCondition = ['nte', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 298 | - return $this; |
|
| 299 | - } |
|
| 295 | +public function ifnte($xValue1, $xValue2): self |
|
| 296 | +{ |
|
| 297 | +$this->aCondition = ['nte', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 298 | +return $this; |
|
| 299 | +} |
|
| 300 | 300 | |
| 301 | - /** |
|
| 301 | +/** |
|
| 302 | 302 | * Check if a value is greater than another before sending the request |
| 303 | 303 | * |
| 304 | 304 | * @param mixed $xValue1 The first value to compare |
@@ -306,13 +306,13 @@ discard block |
||
| 306 | 306 | * |
| 307 | 307 | * @return self |
| 308 | 308 | */ |
| 309 | - public function ifgt($xValue1, $xValue2): self |
|
| 310 | - { |
|
| 311 | - $this->aCondition = ['gt', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 312 | - return $this; |
|
| 313 | - } |
|
| 309 | +public function ifgt($xValue1, $xValue2): self |
|
| 310 | +{ |
|
| 311 | +$this->aCondition = ['gt', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 312 | +return $this; |
|
| 313 | +} |
|
| 314 | 314 | |
| 315 | - /** |
|
| 315 | +/** |
|
| 316 | 316 | * Check if a value is greater or equal to another before sending the request |
| 317 | 317 | * |
| 318 | 318 | * @param mixed $xValue1 The first value to compare |
@@ -320,13 +320,13 @@ discard block |
||
| 320 | 320 | * |
| 321 | 321 | * @return self |
| 322 | 322 | */ |
| 323 | - public function ifge($xValue1, $xValue2): self |
|
| 324 | - { |
|
| 325 | - $this->aCondition = ['ge', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 326 | - return $this; |
|
| 327 | - } |
|
| 323 | +public function ifge($xValue1, $xValue2): self |
|
| 324 | +{ |
|
| 325 | +$this->aCondition = ['ge', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 326 | +return $this; |
|
| 327 | +} |
|
| 328 | 328 | |
| 329 | - /** |
|
| 329 | +/** |
|
| 330 | 330 | * Check if a value is lower than another before sending the request |
| 331 | 331 | * |
| 332 | 332 | * @param mixed $xValue1 The first value to compare |
@@ -334,13 +334,13 @@ discard block |
||
| 334 | 334 | * |
| 335 | 335 | * @return self |
| 336 | 336 | */ |
| 337 | - public function iflt($xValue1, $xValue2): self |
|
| 338 | - { |
|
| 339 | - $this->aCondition = ['lt', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 340 | - return $this; |
|
| 341 | - } |
|
| 337 | +public function iflt($xValue1, $xValue2): self |
|
| 338 | +{ |
|
| 339 | +$this->aCondition = ['lt', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 340 | +return $this; |
|
| 341 | +} |
|
| 342 | 342 | |
| 343 | - /** |
|
| 343 | +/** |
|
| 344 | 344 | * Check if a value is lower or equal to another before sending the request |
| 345 | 345 | * |
| 346 | 346 | * @param mixed $xValue1 The first value to compare |
@@ -348,13 +348,13 @@ discard block |
||
| 348 | 348 | * |
| 349 | 349 | * @return self |
| 350 | 350 | */ |
| 351 | - public function ifle($xValue1, $xValue2): self |
|
| 352 | - { |
|
| 353 | - $this->aCondition = ['le', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 354 | - return $this; |
|
| 355 | - } |
|
| 351 | +public function ifle($xValue1, $xValue2): self |
|
| 352 | +{ |
|
| 353 | +$this->aCondition = ['le', TypedValue::make($xValue1), TypedValue::make($xValue2)]; |
|
| 354 | +return $this; |
|
| 355 | +} |
|
| 356 | 356 | |
| 357 | - /** |
|
| 357 | +/** |
|
| 358 | 358 | * Add a condition to the request |
| 359 | 359 | * |
| 360 | 360 | * The request is sent only if the condition is true. |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | * |
| 364 | 364 | * @return self |
| 365 | 365 | */ |
| 366 | - public function when($xCondition): self |
|
| 367 | - { |
|
| 368 | - return $this->ifeq(true, $xCondition); |
|
| 369 | - } |
|
| 366 | +public function when($xCondition): self |
|
| 367 | +{ |
|
| 368 | +return $this->ifeq(true, $xCondition); |
|
| 369 | +} |
|
| 370 | 370 | |
| 371 | - /** |
|
| 371 | +/** |
|
| 372 | 372 | * Add a condition to the request |
| 373 | 373 | * |
| 374 | 374 | * The request is sent only if the condition is false. |
@@ -377,78 +377,78 @@ discard block |
||
| 377 | 377 | * |
| 378 | 378 | * @return self |
| 379 | 379 | */ |
| 380 | - public function unless($xCondition): self |
|
| 381 | - { |
|
| 382 | - return $this->ifeq(false, $xCondition); |
|
| 383 | - } |
|
| 380 | +public function unless($xCondition): self |
|
| 381 | +{ |
|
| 382 | +return $this->ifeq(false, $xCondition); |
|
| 383 | +} |
|
| 384 | 384 | |
| 385 | - /** |
|
| 385 | +/** |
|
| 386 | 386 | * @return self |
| 387 | 387 | */ |
| 388 | - public function toInt(): self |
|
| 389 | - { |
|
| 390 | - $this->aCalls[] = [ |
|
| 391 | - '_type' => 'func', |
|
| 392 | - '_name' => 'toInt', |
|
| 393 | - ]; |
|
| 394 | - return $this; |
|
| 395 | - } |
|
| 388 | +public function toInt(): self |
|
| 389 | +{ |
|
| 390 | +$this->aCalls[] = [ |
|
| 391 | +'_type' => 'func', |
|
| 392 | +'_name' => 'toInt', |
|
| 393 | +]; |
|
| 394 | +return $this; |
|
| 395 | +} |
|
| 396 | 396 | |
| 397 | - /** |
|
| 397 | +/** |
|
| 398 | 398 | * @return self |
| 399 | 399 | */ |
| 400 | - public function trim(): self |
|
| 401 | - { |
|
| 402 | - $this->aCalls[] = [ |
|
| 403 | - '_type' => 'func', |
|
| 404 | - '_name' => 'trim', |
|
| 405 | - ]; |
|
| 406 | - return $this; |
|
| 407 | - } |
|
| 400 | +public function trim(): self |
|
| 401 | +{ |
|
| 402 | +$this->aCalls[] = [ |
|
| 403 | +'_type' => 'func', |
|
| 404 | +'_name' => 'trim', |
|
| 405 | +]; |
|
| 406 | +return $this; |
|
| 407 | +} |
|
| 408 | 408 | |
| 409 | - /** |
|
| 409 | +/** |
|
| 410 | 410 | * @inheritDoc |
| 411 | 411 | */ |
| 412 | - public function getType(): string |
|
| 413 | - { |
|
| 414 | - return 'expr'; |
|
| 415 | - } |
|
| 412 | +public function getType(): string |
|
| 413 | +{ |
|
| 414 | +return 'expr'; |
|
| 415 | +} |
|
| 416 | 416 | |
| 417 | - /** |
|
| 417 | +/** |
|
| 418 | 418 | * Convert this call to array, when converting the response into json. |
| 419 | 419 | * |
| 420 | 420 | * @return array |
| 421 | 421 | */ |
| 422 | - public function jsonSerialize(): array |
|
| 423 | - { |
|
| 424 | - $aJsExpr = [ |
|
| 425 | - '_type' => $this->getType(), |
|
| 426 | - 'calls' => array_map(fn(JsonSerializable|array $xCall) => |
|
| 427 | - is_array($xCall) ? $xCall : $xCall->jsonSerialize(), $this->aCalls), |
|
| 428 | - ]; |
|
| 429 | - if(($this->aConfirm)) |
|
| 430 | - { |
|
| 431 | - $aJsExpr['confirm'] = $this->aConfirm; |
|
| 432 | - } |
|
| 433 | - if(($this->aCondition)) |
|
| 434 | - { |
|
| 435 | - $aJsExpr['condition'] = $this->aCondition; |
|
| 436 | - } |
|
| 437 | - if(($this->aAlert)) |
|
| 438 | - { |
|
| 439 | - $aJsExpr['alert'] = $this->aAlert; |
|
| 440 | - } |
|
| 441 | - |
|
| 442 | - return $aJsExpr; |
|
| 443 | - } |
|
| 444 | - |
|
| 445 | - /** |
|
| 422 | +public function jsonSerialize(): array |
|
| 423 | +{ |
|
| 424 | +$aJsExpr = [ |
|
| 425 | +'_type' => $this->getType(), |
|
| 426 | +'calls' => array_map(fn(JsonSerializable|array $xCall) => |
|
| 427 | + is_array($xCall) ? $xCall : $xCall->jsonSerialize(), $this->aCalls), |
|
| 428 | +]; |
|
| 429 | +if(($this->aConfirm)) |
|
| 430 | +{ |
|
| 431 | +$aJsExpr['confirm'] = $this->aConfirm; |
|
| 432 | +} |
|
| 433 | +if(($this->aCondition)) |
|
| 434 | +{ |
|
| 435 | +$aJsExpr['condition'] = $this->aCondition; |
|
| 436 | +} |
|
| 437 | +if(($this->aAlert)) |
|
| 438 | +{ |
|
| 439 | +$aJsExpr['alert'] = $this->aAlert; |
|
| 440 | +} |
|
| 441 | + |
|
| 442 | +return $aJsExpr; |
|
| 443 | +} |
|
| 444 | + |
|
| 445 | +/** |
|
| 446 | 446 | * Returns a call to jaxon as a string |
| 447 | 447 | * |
| 448 | 448 | * @return string |
| 449 | 449 | */ |
| 450 | - public function __toString(): string |
|
| 451 | - { |
|
| 452 | - return 'jaxon.exec(' . json_encode($this->jsonSerialize()) . ')'; |
|
| 453 | - } |
|
| 450 | +public function __toString(): string |
|
| 451 | +{ |
|
| 452 | +return 'jaxon.exec(' . json_encode($this->jsonSerialize()) . ')'; |
|
| 453 | +} |
|
| 454 | 454 | } |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function func(): ?Func |
| 91 | 91 | { |
| 92 | - foreach($this->aCalls as $xCall) |
|
| 92 | + foreach ($this->aCalls as $xCall) |
|
| 93 | 93 | { |
| 94 | - if(is_a($xCall, Func::class)) |
|
| 94 | + if (is_a($xCall, Func::class)) |
|
| 95 | 95 | { |
| 96 | 96 | return $xCall; |
| 97 | 97 | } |
@@ -426,15 +426,15 @@ discard block |
||
| 426 | 426 | 'calls' => array_map(fn(JsonSerializable|array $xCall) => |
| 427 | 427 | is_array($xCall) ? $xCall : $xCall->jsonSerialize(), $this->aCalls), |
| 428 | 428 | ]; |
| 429 | - if(($this->aConfirm)) |
|
| 429 | + if (($this->aConfirm)) |
|
| 430 | 430 | { |
| 431 | 431 | $aJsExpr['confirm'] = $this->aConfirm; |
| 432 | 432 | } |
| 433 | - if(($this->aCondition)) |
|
| 433 | + if (($this->aCondition)) |
|
| 434 | 434 | { |
| 435 | 435 | $aJsExpr['condition'] = $this->aCondition; |
| 436 | 436 | } |
| 437 | - if(($this->aAlert)) |
|
| 437 | + if (($this->aAlert)) |
|
| 438 | 438 | { |
| 439 | 439 | $aJsExpr['alert'] = $this->aAlert; |
| 440 | 440 | } |
@@ -19,25 +19,25 @@ |
||
| 19 | 19 | |
| 20 | 20 | class JsObjectCall extends AbstractJsCall |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * The class constructor |
| 24 | 24 | * |
| 25 | 25 | * @param Closure|null $xExprCb |
| 26 | 26 | * @param string $sJsObject |
| 27 | 27 | */ |
| 28 | - public function __construct(?Closure $xExprCb, protected string $sJsObject) |
|
| 29 | - { |
|
| 30 | - parent::__construct($xExprCb); |
|
| 31 | - } |
|
| 28 | +public function __construct(?Closure $xExprCb, protected string $sJsObject) |
|
| 29 | +{ |
|
| 30 | +parent::__construct($xExprCb); |
|
| 31 | +} |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * Get the call to add to the expression |
| 35 | 35 | * |
| 36 | 36 | * @return Attr |
| 37 | 37 | */ |
| 38 | - protected function _exprCall(): Attr |
|
| 39 | - { |
|
| 40 | - // If the value is '', return the js "window" object, otherwise, the corresponding js object. |
|
| 41 | - return Attr::get($this->sJsObject ?: 'window'); |
|
| 42 | - } |
|
| 38 | +protected function _exprCall(): Attr |
|
| 39 | +{ |
|
| 40 | +// If the value is '', return the js "window" object, otherwise, the corresponding js object. |
|
| 41 | +return Attr::get($this->sJsObject ?: 'window'); |
|
| 42 | +} |
|
| 43 | 43 | } |
@@ -20,31 +20,31 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | class JqSelectorCall extends AbstractJsCall |
| 22 | 22 | { |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * The constructor. |
| 25 | 25 | * |
| 26 | 26 | * @param Closure|null $xExprCb |
| 27 | 27 | * @param string $sSelector The jQuery selector path |
| 28 | 28 | * @param mixed $xContext A context associated to the selector |
| 29 | 29 | */ |
| 30 | - public function __construct(?Closure $xExprCb, protected string $sSelector, |
|
| 31 | - protected $xContext = null) |
|
| 32 | - { |
|
| 33 | - parent::__construct($xExprCb); |
|
| 34 | - } |
|
| 30 | +public function __construct(?Closure $xExprCb, protected string $sSelector, |
|
| 31 | +protected $xContext = null) |
|
| 32 | +{ |
|
| 33 | +parent::__construct($xExprCb); |
|
| 34 | +} |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * Get the call to add to the expression |
| 38 | 38 | * |
| 39 | 39 | * @return Selector |
| 40 | 40 | */ |
| 41 | - protected function _exprCall(): Selector |
|
| 42 | - { |
|
| 43 | - // If the value is '', return the js "this" object, otherwise, the selected DOM element. |
|
| 44 | - return new Selector('jq', $this->sSelector ?: 'this', $this->xContext); |
|
| 45 | - } |
|
| 41 | +protected function _exprCall(): Selector |
|
| 42 | +{ |
|
| 43 | +// If the value is '', return the js "this" object, otherwise, the selected DOM element. |
|
| 44 | +return new Selector('jq', $this->sSelector ?: 'this', $this->xContext); |
|
| 45 | +} |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * Set an event handler on the first selected element |
| 49 | 49 | * |
| 50 | 50 | * @param string $sName |
@@ -52,20 +52,20 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return JsExpr |
| 54 | 54 | */ |
| 55 | - public function on(string $sName, JsExpr $xHandler): JsExpr |
|
| 56 | - { |
|
| 57 | - return $this->_expr()->event('jq', $sName, $xHandler); |
|
| 58 | - } |
|
| 55 | +public function on(string $sName, JsExpr $xHandler): JsExpr |
|
| 56 | +{ |
|
| 57 | +return $this->_expr()->event('jq', $sName, $xHandler); |
|
| 58 | +} |
|
| 59 | 59 | |
| 60 | - /** |
|
| 60 | +/** |
|
| 61 | 61 | * Set an "click" event handler on the first selected element |
| 62 | 62 | * |
| 63 | 63 | * @param JsExpr $xHandler |
| 64 | 64 | * |
| 65 | 65 | * @return JsExpr |
| 66 | 66 | */ |
| 67 | - public function click(JsExpr $xHandler): JsExpr |
|
| 68 | - { |
|
| 69 | - return $this->_expr()->event('jq', 'click', $xHandler); |
|
| 70 | - } |
|
| 67 | +public function click(JsExpr $xHandler): JsExpr |
|
| 68 | +{ |
|
| 69 | +return $this->_expr()->event('jq', 'click', $xHandler); |
|
| 70 | +} |
|
| 71 | 71 | } |
@@ -16,23 +16,23 @@ |
||
| 16 | 16 | |
| 17 | 17 | class JxnClassCall extends JxnCall |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * The class constructor |
| 21 | 21 | * |
| 22 | 22 | * @param string $sJsObject |
| 23 | 23 | */ |
| 24 | - public function __construct(protected string $sJsObject) |
|
| 25 | - { |
|
| 26 | - parent::__construct("$sJsObject."); |
|
| 27 | - } |
|
| 24 | +public function __construct(protected string $sJsObject) |
|
| 25 | +{ |
|
| 26 | +parent::__construct("$sJsObject."); |
|
| 27 | +} |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * Get the js class name |
| 31 | 31 | * |
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | - public function _class(): string |
|
| 35 | - { |
|
| 36 | - return $this->sJsObject; |
|
| 37 | - } |
|
| 34 | +public function _class(): string |
|
| 35 | +{ |
|
| 36 | +return $this->sJsObject; |
|
| 37 | +} |
|
| 38 | 38 | } |