@@ -79,18 +79,18 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function makePhrase(array $aArgs): string |
81 | 81 | { |
82 | - if(empty($aArgs)) |
|
82 | + if (empty($aArgs)) |
|
83 | 83 | { |
84 | 84 | return ''; |
85 | 85 | } |
86 | 86 | // The first array entry is the message. |
87 | 87 | $sPhrase = array_shift($aArgs); |
88 | - if(empty($aArgs)) |
|
88 | + if (empty($aArgs)) |
|
89 | 89 | { |
90 | 90 | return $sPhrase; |
91 | 91 | } |
92 | 92 | $nParamId = 1; |
93 | - foreach($aArgs as &$xParameter) |
|
93 | + foreach ($aArgs as &$xParameter) |
|
94 | 94 | { |
95 | 95 | $xParameter = "'$nParamId':" . $xParameter->getScript(); |
96 | 96 | $nParamId++; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | private function makeMessage(): string |
107 | 107 | { |
108 | - if(!($sPhrase = $this->makePhrase($this->aMessageArgs))) |
|
108 | + if (!($sPhrase = $this->makePhrase($this->aMessageArgs))) |
|
109 | 109 | { |
110 | 110 | return ''; |
111 | 111 | } |
@@ -124,16 +124,15 @@ discard block |
||
124 | 124 | { |
125 | 125 | $sMessageScript = $this->makeMessage(); |
126 | 126 | $sScript = parent::getScript(); |
127 | - if($this->bConfirm) |
|
127 | + if ($this->bConfirm) |
|
128 | 128 | { |
129 | 129 | $sConfirmPhrase = $this->makePhrase($this->aConfirmArgs); |
130 | 130 | $sScript = $this->xDialogLibraryManager->getQuestionLibrary() |
131 | 131 | ->confirm($sConfirmPhrase, $sScript, $sMessageScript); |
132 | 132 | } |
133 | - if($this->sCondition !== '') |
|
133 | + if ($this->sCondition !== '') |
|
134 | 134 | { |
135 | - $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' : |
|
136 | - 'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}'; |
|
135 | + $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' : 'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}'; |
|
137 | 136 | } |
138 | 137 | return $this->sVars . $sScript; |
139 | 138 | } |
@@ -145,9 +144,9 @@ discard block |
||
145 | 144 | */ |
146 | 145 | public function hasPageNumber(): bool |
147 | 146 | { |
148 | - foreach($this->aParameters as $xParameter) |
|
147 | + foreach ($this->aParameters as $xParameter) |
|
149 | 148 | { |
150 | - if($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
149 | + if ($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
151 | 150 | { |
152 | 151 | return true; |
153 | 152 | } |
@@ -165,9 +164,9 @@ discard block |
||
165 | 164 | public function setPageNumber(int $nPageNumber): Call |
166 | 165 | { |
167 | 166 | // Set the value of the Parameter::PAGE_NUMBER parameter |
168 | - foreach($this->aParameters as $xParameter) |
|
167 | + foreach ($this->aParameters as $xParameter) |
|
169 | 168 | { |
170 | - if($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
169 | + if ($xParameter->getType() === Parameter::PAGE_NUMBER) |
|
171 | 170 | { |
172 | 171 | $xParameter->setValue($nPageNumber); |
173 | 172 | break; |
@@ -188,7 +187,7 @@ discard block |
||
188 | 187 | public function pg(int $nCurrentPage, int $nItemsPerPage, int $nItemsTotal): Paginator |
189 | 188 | { |
190 | 189 | // Append the page number to the parameter list, if not yet given. |
191 | - if(!$this->hasPageNumber()) |
|
190 | + if (!$this->hasPageNumber()) |
|
192 | 191 | { |
193 | 192 | $this->addParameter(Parameter::PAGE_NUMBER, 0); |
194 | 193 | } |
@@ -121,7 +121,7 @@ |
||
121 | 121 | */ |
122 | 122 | public function addParameters(array $aParameters): JsCall |
123 | 123 | { |
124 | - foreach($aParameters as $xParameter) |
|
124 | + foreach ($aParameters as $xParameter) |
|
125 | 125 | { |
126 | 126 | $this->pushParameter(Parameter::make($xParameter)); |
127 | 127 | } |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | */ |
87 | 87 | private function getPath(string $jQueryNs, string $sPath, $xContext) |
88 | 88 | { |
89 | - if(!$sPath) |
|
89 | + if (!$sPath) |
|
90 | 90 | { |
91 | 91 | // If an empty selector is given, use the event target instead |
92 | 92 | return "$jQueryNs(e.currentTarget)"; |
93 | 93 | } |
94 | - if(!$xContext) |
|
94 | + if (!$xContext) |
|
95 | 95 | { |
96 | 96 | return "$jQueryNs('" . $sPath . "')"; |
97 | 97 | } |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function __call(string $sMethod, array $aArguments) |
112 | 112 | { |
113 | - if(count($aArguments) === 1) |
|
113 | + if (count($aArguments) === 1) |
|
114 | 114 | { |
115 | 115 | // If the only parameter is a selector, and the first call |
116 | 116 | // on that selector is a method, then the selector is a callback. |
117 | 117 | $xArgument = $aArguments[0]; |
118 | - if(is_a($xArgument, self::class) && $xArgument->bIsCallback === null && |
|
118 | + if (is_a($xArgument, self::class) && $xArgument->bIsCallback === null && |
|
119 | 119 | count($xArgument->aCalls) > 0 && is_a($xArgument->aCalls[0], JsCall::class)) |
120 | 120 | { |
121 | 121 | $xArgument->bIsCallback = true; |
@@ -188,12 +188,11 @@ discard block |
||
188 | 188 | public function getScript(): string |
189 | 189 | { |
190 | 190 | $sScript = $this->sPath; |
191 | - if(count($this->aCalls) > 0) |
|
191 | + if (count($this->aCalls) > 0) |
|
192 | 192 | { |
193 | 193 | $sScript .= '.' . implode('.', $this->aCalls); |
194 | 194 | } |
195 | - return $this->bIsCallback ? '(e) => {' . $sScript . '}' : |
|
196 | - ($this->bToInt ? "parseInt($sScript)" : $sScript); |
|
195 | + return $this->bIsCallback ? '(e) => {' . $sScript . '}' : ($this->bToInt ? "parseInt($sScript)" : $sScript); |
|
197 | 196 | } |
198 | 197 | |
199 | 198 | /** |