@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function isExists() |
| 85 | 85 | { |
| 86 | 86 | $id = (int) $this->get('id'); |
| 87 | - return ! empty($id); |
|
| 87 | + return !empty($id); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | switch ($key) { |
| 129 | 129 | case 'id': |
| 130 | - if (! EBB\isValidID($value)) { |
|
| 130 | + if (!EBB\isValidID($value)) { |
|
| 131 | 131 | throw new InvalidArgumentException(__('Invalid city ID.')); |
| 132 | 132 | } |
| 133 | 133 | break; |
| 134 | 134 | case 'name': |
| 135 | - if (! is_string($value) || empty($value)) { |
|
| 135 | + if (!is_string($value) || empty($value)) { |
|
| 136 | 136 | throw new InvalidArgumentException(__('Invalid city name.')); |
| 137 | 137 | } |
| 138 | 138 | break; |
| 139 | 139 | case 'created_by': |
| 140 | - if (! $value instanceof User || ! $value->isExists()) { |
|
| 140 | + if (!$value instanceof User || !$value->isExists()) { |
|
| 141 | 141 | throw new InvalidArgumentException(__('Invalid city originator.')); |
| 142 | 142 | } |
| 143 | 143 | break; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | public function isExists() |
| 117 | 117 | { |
| 118 | 118 | $id = (int) $this->get('id'); |
| 119 | - return ! empty($id); |
|
| 119 | + return !empty($id); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -185,32 +185,32 @@ discard block |
||
| 185 | 185 | { |
| 186 | 186 | switch ($key) { |
| 187 | 187 | case 'id': |
| 188 | - if (! EBB\isValidID($value)) { |
|
| 188 | + if (!EBB\isValidID($value)) { |
|
| 189 | 189 | throw new InvalidArgumentException(__('Invalid user ID.')); |
| 190 | 190 | } |
| 191 | 191 | break; |
| 192 | 192 | case 'name': |
| 193 | - if (! is_string($value) || empty($value)) { |
|
| 193 | + if (!is_string($value) || empty($value)) { |
|
| 194 | 194 | throw new InvalidArgumentException(__('Invalid user name.')); |
| 195 | 195 | } |
| 196 | 196 | break; |
| 197 | 197 | case 'email': |
| 198 | - if (! EBB\isValidEmail($value)) { |
|
| 198 | + if (!EBB\isValidEmail($value)) { |
|
| 199 | 199 | throw new InvalidArgumentException(__('Invalid user e-mail.')); |
| 200 | 200 | } |
| 201 | 201 | break; |
| 202 | 202 | case 'pass': |
| 203 | - if (! is_string($value) || empty($value)) { |
|
| 203 | + if (!is_string($value) || empty($value)) { |
|
| 204 | 204 | throw new InvalidArgumentException(__('Invalid user password.')); |
| 205 | 205 | } |
| 206 | 206 | break; |
| 207 | 207 | case 'role': |
| 208 | - if (! is_string($value)) { |
|
| 208 | + if (!is_string($value)) { |
|
| 209 | 209 | throw new InvalidArgumentException(__('Invalid user role.')); |
| 210 | 210 | } |
| 211 | 211 | break; |
| 212 | 212 | case 'status': |
| 213 | - if (! is_string($value) || empty($value)) { |
|
| 213 | + if (!is_string($value) || empty($value)) { |
|
| 214 | 214 | throw new InvalidArgumentException(__('Invalid user status.')); |
| 215 | 215 | } |
| 216 | 216 | break; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | public function isExists() |
| 84 | 84 | { |
| 85 | 85 | $id = (int) $this->get('id'); |
| 86 | - return ! empty($id); |
|
| 86 | + return !empty($id); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -126,22 +126,22 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | switch ($key) { |
| 128 | 128 | case 'id': |
| 129 | - if (! EBB\isValidID($value)) { |
|
| 129 | + if (!EBB\isValidID($value)) { |
|
| 130 | 130 | throw new InvalidArgumentException(__('Invalid district ID.')); |
| 131 | 131 | } |
| 132 | 132 | break; |
| 133 | 133 | case 'name': |
| 134 | - if (! is_string($value) || empty($value)) { |
|
| 134 | + if (!is_string($value) || empty($value)) { |
|
| 135 | 135 | throw new InvalidArgumentException(__('Invalid district name.')); |
| 136 | 136 | } |
| 137 | 137 | break; |
| 138 | 138 | case 'city': |
| 139 | - if (! $value instanceof City || ! $value->isExists()) { |
|
| 139 | + if (!$value instanceof City || !$value->isExists()) { |
|
| 140 | 140 | throw new InvalidArgumentException(__('Invalid district city.')); |
| 141 | 141 | } |
| 142 | 142 | break; |
| 143 | 143 | case 'created_by': |
| 144 | - if (! $value instanceof User || ! $value->isExists()) { |
|
| 144 | + if (!$value instanceof User || !$value->isExists()) { |
|
| 145 | 145 | throw new InvalidArgumentException(__('Invalid district originator.')); |
| 146 | 146 | } |
| 147 | 147 | break; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public function isExists() |
| 139 | 139 | { |
| 140 | 140 | $id = (int) $this->get('id'); |
| 141 | - return ! empty($id); |
|
| 141 | + return !empty($id); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -235,37 +235,37 @@ discard block |
||
| 235 | 235 | { |
| 236 | 236 | switch ($key) { |
| 237 | 237 | case 'id': |
| 238 | - if (! EBB\isValidID($value)) { |
|
| 238 | + if (!EBB\isValidID($value)) { |
|
| 239 | 239 | throw new InvalidArgumentException(__('Invalid donor ID.')); |
| 240 | 240 | } |
| 241 | 241 | break; |
| 242 | 242 | case 'name': |
| 243 | - if (! is_string($value) || empty($value)) { |
|
| 243 | + if (!is_string($value) || empty($value)) { |
|
| 244 | 244 | throw new InvalidArgumentException(__('Invalid donor name.')); |
| 245 | 245 | } |
| 246 | 246 | break; |
| 247 | 247 | case 'gender': |
| 248 | - if (! array_key_exists($value, EBB\getGenders())) { |
|
| 248 | + if (!array_key_exists($value, EBB\getGenders())) { |
|
| 249 | 249 | throw new InvalidArgumentException(__('Invalid donor gender.')); |
| 250 | 250 | } |
| 251 | 251 | break; |
| 252 | 252 | case 'blood_group': |
| 253 | - if (! in_array($value, EBB\getBloodGroups(), true)) { |
|
| 253 | + if (!in_array($value, EBB\getBloodGroups(), true)) { |
|
| 254 | 254 | throw new InvalidArgumentException(__('Invalid donor blood group.')); |
| 255 | 255 | } |
| 256 | 256 | break; |
| 257 | 257 | case 'district': |
| 258 | - if (! $value instanceof District || ! $value->isExists()) { |
|
| 258 | + if (!$value instanceof District || !$value->isExists()) { |
|
| 259 | 259 | throw new InvalidArgumentException(__('Invalid donor district.')); |
| 260 | 260 | } |
| 261 | 261 | break; |
| 262 | 262 | case 'created_by': |
| 263 | - if (! $value instanceof User || ! $value->isExists()) { |
|
| 263 | + if (!$value instanceof User || !$value->isExists()) { |
|
| 264 | 264 | throw new InvalidArgumentException(__('Invalid donor originator.')); |
| 265 | 265 | } |
| 266 | 266 | break; |
| 267 | 267 | case 'status': |
| 268 | - if (! is_string($value) || empty($value)) { |
|
| 268 | + if (!is_string($value) || empty($value)) { |
|
| 269 | 269 | throw new InvalidArgumentException(__('Invalid donor status.')); |
| 270 | 270 | } |
| 271 | 271 | break; |
@@ -309,28 +309,28 @@ discard block |
||
| 309 | 309 | { |
| 310 | 310 | switch ($key) { |
| 311 | 311 | case 'weight': |
| 312 | - if (! empty($value) && ! EBB\isValidFloat($value)) { |
|
| 312 | + if (!empty($value) && !EBB\isValidFloat($value)) { |
|
| 313 | 313 | // TODO: Check Min and Max weight. |
| 314 | 314 | throw new InvalidArgumentException(__('Invalid donor weight.')); |
| 315 | 315 | } |
| 316 | 316 | break; |
| 317 | 317 | case 'email': |
| 318 | - if (! empty($value) && ! EBB\isValidEmail($value)) { |
|
| 318 | + if (!empty($value) && !EBB\isValidEmail($value)) { |
|
| 319 | 319 | throw new InvalidArgumentException(__('Invalid donor e-mail address.')); |
| 320 | 320 | } |
| 321 | 321 | break; |
| 322 | 322 | case 'email_visibility': |
| 323 | - if (! empty($value) && ! array_key_exists($value, EBB\getVisibilities())) { |
|
| 323 | + if (!empty($value) && !array_key_exists($value, EBB\getVisibilities())) { |
|
| 324 | 324 | throw new InvalidArgumentException(__('Invalid donor e-mail address visibility.')); |
| 325 | 325 | } |
| 326 | 326 | break; |
| 327 | 327 | case 'phone': |
| 328 | - if (! empty($value) && ! ctype_digit($value)) { |
|
| 328 | + if (!empty($value) && !ctype_digit($value)) { |
|
| 329 | 329 | throw new InvalidArgumentException(__('Invalid donor phone number.')); |
| 330 | 330 | } |
| 331 | 331 | break; |
| 332 | 332 | case 'phone_visibility': |
| 333 | - if (! empty($value) && ! array_key_exists($value, EBB\getVisibilities())) { |
|
| 333 | + if (!empty($value) && !array_key_exists($value, EBB\getVisibilities())) { |
|
| 334 | 334 | throw new InvalidArgumentException(__('Invalid donor phone number visibility.')); |
| 335 | 335 | } |
| 336 | 336 | break; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function __invoke() |
| 34 | 34 | { |
| 35 | - if (! $this->hasAuthenticatedUser() || ! $this->getAcl()->isUserAllowed($this->getAuthenticatedUser(), 'City', 'add')) { |
|
| 35 | + if (!$this->hasAuthenticatedUser() || !$this->getAcl()->isUserAllowed($this->getAuthenticatedUser(), 'City', 'add')) { |
|
| 36 | 36 | $this->viewFactory->displayView('error-403'); |
| 37 | 37 | return; |
| 38 | 38 | } |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | protected function doSubmitAction() |
| 81 | 81 | { |
| 82 | 82 | try { |
| 83 | - if (! $this->hasAuthenticatedUser() || ! $this->getAcl()->isUserAllowed($this->getAuthenticatedUser(), 'City', 'add')) { |
|
| 83 | + if (!$this->hasAuthenticatedUser() || !$this->getAcl()->isUserAllowed($this->getAuthenticatedUser(), 'City', 'add')) { |
|
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $actionToken = filter_input(INPUT_POST, 'token'); |
| 88 | 88 | $sessionToken = $this->getSession()->getCsrfToken(); |
| 89 | 89 | |
| 90 | - if (! $actionToken || ! $sessionToken->isValid($actionToken)) { |
|
| 90 | + if (!$actionToken || !$sessionToken->isValid($actionToken)) { |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $duplicateCity = $this->getCityRepository()->findOneBy(['name' => $city->get('name')]); |
| 100 | 100 | |
| 101 | - if (! empty($duplicateCity)) { |
|
| 101 | + if (!empty($duplicateCity)) { |
|
| 102 | 102 | throw new InvalidArgumentException(__('Please enter a unique city name.')); |
| 103 | 103 | } |
| 104 | 104 | |