Passed
Push — develop ( dc1165...764b3a )
by Nikolay
07:08 queued 11s
created
src/Common/Models/ModelsBase.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@
 block discarded – undo
194 194
                     . '= :field'
195 195
                     . $index . ':';
196 196
                 $bindField
197
-                                                      = $mappedFields[$index];
197
+                                                        = $mappedFields[$index];
198 198
                 $parameters['bind']['field' . $index] = $currentDeleteRecord->$bindField;
199 199
             }
200 200
             $relatedRecords = $relatedModel::find($parameters);
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
                 'lifetime' => 5, //seconds
70 70
             ],
71 71
         ];
72
-        $modules    = PbxExtensionModules::find($parameters)->toArray();
72
+        $modules = PbxExtensionModules::find($parameters)->toArray();
73 73
         foreach ($modules as $module) {
74 74
             $moduleDir = PbxExtensionUtils::getModuleDir($module['uniqid']);
75 75
 
76 76
             $moduleJson = "{$moduleDir}/module.json";
77
-            if ( ! file_exists($moduleJson)) {
77
+            if (!file_exists($moduleJson)) {
78 78
                 continue;
79 79
             }
80 80
             $jsonString            = file_get_contents($moduleJson);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             }
86 86
 
87 87
             $moduleModelsDir = "{$moduleDir}/Models";
88
-            $results         = glob($moduleModelsDir . '/*.php', GLOB_NOSORT);
88
+            $results         = glob($moduleModelsDir.'/*.php', GLOB_NOSORT);
89 89
             foreach ($results as $file) {
90 90
                 $className        = pathinfo($file)['filename'];
91 91
                 $moduleModelClass = "\\Modules\\{$module['uniqid']}\\Models\\{$className}";
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
                 $newErrorMessage = $this->t('ConstraintViolation');
121 121
                 $newErrorMessage .= "<ul class='list'>";
122 122
                 if ($relatedRecords === false) {
123
-                    throw new Model\Exception('Error on models relationship ' . $errorMessage);
123
+                    throw new Model\Exception('Error on models relationship '.$errorMessage);
124 124
                 }
125 125
                 if ($relatedRecords instanceof Resultset) {
126 126
                     foreach ($relatedRecords as $item) {
127 127
                         if ($item instanceof ModelsBase) {
128
-                            $newErrorMessage .= '<li>' . $item->getRepresent(true) . '</li>';
128
+                            $newErrorMessage .= '<li>'.$item->getRepresent(true).'</li>';
129 129
                         }
130 130
                     }
131 131
                 } elseif ($relatedRecords instanceof ModelsBase) {
132
-                    $newErrorMessage .= '<li>' . $relatedRecords->getRepresent(true) . '</li>';
132
+                    $newErrorMessage .= '<li>'.$relatedRecords->getRepresent(true).'</li>';
133 133
                 } else {
134 134
                     $newErrorMessage .= '<li>Unknown object</li>';
135 135
                 }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                 if (empty($this->id)) {
181 181
                     $name .= $this->t('mo_NewElementCallQueues');
182 182
                 } else {
183
-                    $name .= $this->t('mo_CallQueueShort4Dropdown') . ': ' . $this->name;
183
+                    $name .= $this->t('mo_CallQueueShort4Dropdown').': '.$this->name;
184 184
                 }
185 185
                 break;
186 186
             case ConferenceRooms::class:
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 if (empty($this->id)) {
189 189
                     $name .= $this->t('mo_NewElementConferenceRooms');
190 190
                 } else {
191
-                    $name .= $this->t('mo_ConferenceRoomsShort4Dropdown') . ': ' . $this->name;;
191
+                    $name .= $this->t('mo_ConferenceRoomsShort4Dropdown').': '.$this->name; ;
192 192
                 }
193 193
                 break;
194 194
             case CustomFiles::class:
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                 if (empty($this->id)) {
200 200
                     $name .= $this->t('mo_NewElementDialplanApplications');
201 201
                 } else {
202
-                    $name .= $this->t('mo_ApplicationShort4Dropdown') . ': ' . $this->name;;
202
+                    $name .= $this->t('mo_ApplicationShort4Dropdown').': '.$this->name; ;
203 203
                 }
204 204
                 break;
205 205
             case ExtensionForwardingRights::class:
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 if (empty($this->id)) {
262 262
                     $name .= $this->t('mo_NewElementIax');
263 263
                 } elseif ($this->disabled === '1') {
264
-                    $name .= "{$this->description} ({$this->t( 'mo_Disabled' )})";
264
+                    $name .= "{$this->description} ({$this->t('mo_Disabled')})";
265 265
                 } else {
266 266
                     $name .= $this->description;
267 267
                 }
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                 if (empty($this->id)) {
272 272
                     $name .= $this->t('mo_NewElementIvrMenu');
273 273
                 } else {
274
-                    $name .= $this->t('mo_IVRMenuShort4Dropdown') . ': ' . $this->name;
274
+                    $name .= $this->t('mo_IVRMenuShort4Dropdown').': '.$this->name;
275 275
                 }
276 276
                 break;
277 277
             case IvrMenuActions::class:
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                 $name = '<i class="map signs icon"></i> ';
285 285
                 if (empty($this->id)) {
286 286
                     $name .= $this->t('mo_NewElementIncomingRoutingTable');
287
-                } elseif ( ! empty($this->note)) {
287
+                } elseif (!empty($this->note)) {
288 288
                     $name .= $this->t('repIncomingRoutingTable', ['represent' => $this->note]);
289 289
                 } else {
290 290
                     $name .= $this->t('repIncomingRoutingTableNumber', ['represent' => $this->id]);
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
                 if (empty($this->id)) {
300 300
                     $name .= $this->t('mo_NewElementNetworkFilters');
301 301
                 } else {
302
-                    $name .= $this->description . '('
303
-                        . $this->t('fw_PermitNetwork') . ': ' . $this->permit
302
+                    $name .= $this->description.'('
303
+                        . $this->t('fw_PermitNetwork').': '.$this->permit
304 304
                         . ')';
305 305
                 }
306 306
                 break;
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
                 $name = '<i class="random icon"></i> ';
309 309
                 if (empty($this->id)) {
310 310
                     $name .= $this->t('mo_NewElementOutgoingRoutingTable');
311
-                } elseif ( ! empty($this->rulename)) {
311
+                } elseif (!empty($this->rulename)) {
312 312
                     $name .= $this->t('repOutgoingRoutingTable', ['represent' => $this->rulename]);
313 313
                 } else {
314 314
                     $name .= $this->t('repOutgoingRoutingTableNumber', ['represent' => $this->id]);
@@ -318,24 +318,24 @@  discard block
 block discarded – undo
318 318
                 $name = '<i class="time icon"></i> ';
319 319
                 if (empty($this->id)) {
320 320
                     $name .= $this->t('mo_NewElementOutWorkTimes');
321
-                } elseif ( ! empty($this->description)) {
321
+                } elseif (!empty($this->description)) {
322 322
                     $name .= $this->t('repOutWorkTimes', ['represent' => $this->description]);
323 323
                 } else {
324 324
                     $represent = '';
325 325
                     if (is_numeric($this->date_from)) {
326
-                        $represent .= date("d/m/Y", $this->date_from) . '-';
326
+                        $represent .= date("d/m/Y", $this->date_from).'-';
327 327
                     }
328 328
                     if (is_numeric($this->date_to)) {
329
-                        $represent .= date("d/m/Y", $this->date_to) . ' ';
329
+                        $represent .= date("d/m/Y", $this->date_to).' ';
330 330
                     }
331 331
                     if (isset($this->weekday_from)) {
332
-                        $represent .= $this->t(date('D', strtotime("Sunday +{$this->weekday_from} days"))) . '-';
332
+                        $represent .= $this->t(date('D', strtotime("Sunday +{$this->weekday_from} days"))).'-';
333 333
                     }
334 334
                     if (isset($this->weekday_to)) {
335
-                        $represent .= $this->t(date('D', strtotime("Sunday +{$this->weekday_to} days"))) . ' ';
335
+                        $represent .= $this->t(date('D', strtotime("Sunday +{$this->weekday_to} days"))).' ';
336 336
                     }
337 337
                     if (isset($this->time_from) || isset($this->time_to)) {
338
-                        $represent .= $this->time_from . ' - ' . $this->time_to . ' ';
338
+                        $represent .= $this->time_from.' - '.$this->time_to.' ';
339 339
                     }
340 340
                     $name .= $this->t('repOutWorkTimes', ['represent' => $represent]);
341 341
                 }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
                 break;
353 353
             case PbxExtensionModules::class:
354 354
                 $name = '<i class="puzzle piece icon"></i> '
355
-                    . $this->t('mo_ModuleShort4Dropdown') . ': '
355
+                    . $this->t('mo_ModuleShort4Dropdown').': '
356 356
                     . $this->name;
357 357
                 break;
358 358
             case Sip::class:
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
                 if (empty($this->id)) {
361 361
                     $name .= $this->t('mo_NewElementSip');
362 362
                 } elseif ($this->disabled === '1') {
363
-                    $name .= "{$this->description} ({$this->t( 'mo_Disabled' )})";
363
+                    $name .= "{$this->description} ({$this->t('mo_Disabled')})";
364 364
                 } else {
365 365
                     $name .= $this->description;
366 366
                 }
367 367
 
368 368
                 break;
369 369
             case Users::class:
370
-                $name = '<i class="user outline icon"></i> ' . $this->username;
370
+                $name = '<i class="user outline icon"></i> '.$this->username;
371 371
                 break;
372 372
             case SoundFiles::class:
373 373
                 $name = '<i class="file audio outline icon"></i> ';
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
             $link     = $this->getWebInterfaceLink();
387 387
             $category = explode('\\', static::class)[3];
388 388
             $result   = $this->t(
389
-                'rep' . $category,
389
+                'rep'.$category,
390 390
                 [
391 391
                     'represent' => "<a href='{$link}'>{$name}</a>",
392 392
                 ]
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 
412 412
         if (strlen($s) > $max_length) {
413 413
             $offset = ($max_length - 3) - strlen($s);
414
-            $s      = substr($s, 0, strrpos($s, ' ', $offset)) . '...';
414
+            $s      = substr($s, 0, strrpos($s, ' ', $offset)).'...';
415 415
         }
416 416
 
417 417
         return $s;
@@ -430,80 +430,80 @@  discard block
 block discarded – undo
430 430
         $link    = '#';
431 431
         switch (static::class) {
432 432
             case AsteriskManagerUsers::class:
433
-                $link = $url->get('asterisk-managers/modify/' . $this->id, null, null, $baseUri);
433
+                $link = $url->get('asterisk-managers/modify/'.$this->id, null, null, $baseUri);
434 434
                 break;
435 435
             case CallQueueMembers::class:
436
-                $link = $url->get('call-queues/modify/' . $this->CallQueues->uniqid, null, null, $baseUri);
436
+                $link = $url->get('call-queues/modify/'.$this->CallQueues->uniqid, null, null, $baseUri);
437 437
                 break;
438 438
             case CallQueues::class:
439
-                $link = $url->get('call-queues/modify/' . $this->uniqid, null, null, $baseUri);
439
+                $link = $url->get('call-queues/modify/'.$this->uniqid, null, null, $baseUri);
440 440
                 break;
441 441
             case ConferenceRooms::class:
442
-                $link = $url->get('conference-rooms/modify/' . $this->uniqid, null, null, $baseUri);
442
+                $link = $url->get('conference-rooms/modify/'.$this->uniqid, null, null, $baseUri);
443 443
                 break;
444 444
             case CustomFiles::class:
445
-                $link = $url->get('custom-files/modify/' . $this->id, null, null, $baseUri);
445
+                $link = $url->get('custom-files/modify/'.$this->id, null, null, $baseUri);
446 446
                 break;
447 447
             case DialplanApplications::class:
448
-                $link = $url->get('dialplan-applications/modify/' . $this->uniqid, null, null, $baseUri);
448
+                $link = $url->get('dialplan-applications/modify/'.$this->uniqid, null, null, $baseUri);
449 449
                 break;
450 450
             case ExtensionForwardingRights::class:
451 451
 
452 452
                 break;
453 453
             case Extensions::class:
454
-                $link = $url->get('extensions/modify/' . $this->id, null, null, $baseUri);
454
+                $link = $url->get('extensions/modify/'.$this->id, null, null, $baseUri);
455 455
                 break;
456 456
             case ExternalPhones::class:
457 457
                 if ($this->Extensions->is_general_user_number === "1") {
458
-                    $parameters    = [
459
-                        'conditions' => 'is_general_user_number="1" AND type="' . Extensions::TYPE_EXTERNAL . '" AND userid=:userid:',
458
+                    $parameters = [
459
+                        'conditions' => 'is_general_user_number="1" AND type="'.Extensions::TYPE_EXTERNAL.'" AND userid=:userid:',
460 460
                         'bind'       => [
461 461
                             'userid' => $this->Extensions->userid,
462 462
                         ],
463 463
                     ];
464 464
                     $needExtension = Extensions::findFirst($parameters);
465
-                    $link          = $url->get('extensions/modify/' . $needExtension->id, null, null, $baseUri);
465
+                    $link          = $url->get('extensions/modify/'.$needExtension->id, null, null, $baseUri);
466 466
                 } else {
467
-                    $link = '#';//TODO сделать если будет раздел для допоплнинельных номеров пользователя
467
+                    $link = '#'; //TODO сделать если будет раздел для допоплнинельных номеров пользователя
468 468
                 }
469 469
                 break;
470 470
             case Fail2BanRules::class:
471
-                $link = '#';//TODO сделать если будет fail2ban
471
+                $link = '#'; //TODO сделать если будет fail2ban
472 472
                 break;
473 473
             case FirewallRules::class:
474
-                $link = $url->get('firewall/modify/' . $this->NetworkFilters->id, null, null, $baseUri);
474
+                $link = $url->get('firewall/modify/'.$this->NetworkFilters->id, null, null, $baseUri);
475 475
                 break;
476 476
             case Iax::class:
477
-                $link = $url->get('providers/modifyiax/' . $this->Providers->id, null, null, $baseUri);
477
+                $link = $url->get('providers/modifyiax/'.$this->Providers->id, null, null, $baseUri);
478 478
                 break;
479 479
             case IvrMenu::class:
480
-                $link = $url->get('ivr-menu/modify/' . $this->uniqid, null, null, $baseUri);
480
+                $link = $url->get('ivr-menu/modify/'.$this->uniqid, null, null, $baseUri);
481 481
                 break;
482 482
             case IvrMenuActions::class:
483
-                $link = $url->get('ivr-menu/modify/' . $this->IvrMenu->uniqid, null, null, $baseUri);
483
+                $link = $url->get('ivr-menu/modify/'.$this->IvrMenu->uniqid, null, null, $baseUri);
484 484
                 break;
485 485
             case Codecs::class:
486 486
                 break;
487 487
             case IncomingRoutingTable::class:
488
-                $link = $url->get('incoming-routes/modify/' . $this->id, null, null, $baseUri);
488
+                $link = $url->get('incoming-routes/modify/'.$this->id, null, null, $baseUri);
489 489
                 break;
490 490
             case LanInterfaces::class:
491 491
                 $link = $url->get('network/index/', null, null, $baseUri);
492 492
                 break;
493 493
             case NetworkFilters::class:
494
-                $link = $url->get('firewall/modify/' . $this->id, null, null, $baseUri);
494
+                $link = $url->get('firewall/modify/'.$this->id, null, null, $baseUri);
495 495
                 break;
496 496
             case OutgoingRoutingTable::class:
497
-                $link = $url->get('outbound-routes/modify/' . $this->id, null, null, $baseUri);
497
+                $link = $url->get('outbound-routes/modify/'.$this->id, null, null, $baseUri);
498 498
                 break;
499 499
             case OutWorkTimes::class:
500
-                $link = $url->get('out-off-work-time/modify/' . $this->id, null, null, $baseUri);
500
+                $link = $url->get('out-off-work-time/modify/'.$this->id, null, null, $baseUri);
501 501
                 break;
502 502
             case Providers::class:
503 503
                 if ($this->type === "IAX") {
504
-                    $link = $url->get('providers/modifyiax/' . $this->uniqid, null, null, $baseUri);
504
+                    $link = $url->get('providers/modifyiax/'.$this->uniqid, null, null, $baseUri);
505 505
                 } else {
506
-                    $link = $url->get('providers/modifysip/' . $this->uniqid, null, null, $baseUri);
506
+                    $link = $url->get('providers/modifysip/'.$this->uniqid, null, null, $baseUri);
507 507
                 }
508 508
                 break;
509 509
             case PbxSettings::class:
@@ -515,26 +515,26 @@  discard block
 block discarded – undo
515 515
             case Sip::class:
516 516
                 if ($this->Extensions) { // Это внутренний номер?
517 517
                     if ($this->Extensions->is_general_user_number === "1") {
518
-                        $link = $url->get('extensions/modify/' . $this->Extensions->id, null, null, $baseUri);
518
+                        $link = $url->get('extensions/modify/'.$this->Extensions->id, null, null, $baseUri);
519 519
                     } else {
520
-                        $link = '#';//TODO сделать если будет раздел для допоплнинельных номеров пользователя
520
+                        $link = '#'; //TODO сделать если будет раздел для допоплнинельных номеров пользователя
521 521
                     }
522 522
                 } elseif ($this->Providers) { // Это провайдер
523
-                    $link = $url->get('providers/modifysip/' . $this->Providers->id, null, null, $baseUri);
523
+                    $link = $url->get('providers/modifysip/'.$this->Providers->id, null, null, $baseUri);
524 524
                 }
525 525
                 break;
526 526
             case Users::class:
527
-                $parameters    = [
527
+                $parameters = [
528 528
                     'conditions' => 'userid=:userid:',
529 529
                     'bind'       => [
530 530
                         'userid' => $this->id,
531 531
                     ],
532 532
                 ];
533 533
                 $needExtension = Extensions::findFirst($parameters);
534
-                $link          = $url->get('extensions/modify/' . $needExtension->id, null, null, $baseUri);
534
+                $link          = $url->get('extensions/modify/'.$needExtension->id, null, null, $baseUri);
535 535
                 break;
536 536
             case SoundFiles::class:
537
-                $link = $url->get('sound-files/modify/' . $this->id, null, null, $baseUri);
537
+                $link = $url->get('sound-files/modify/'.$this->id, null, null, $baseUri);
538 538
                 break;
539 539
             default:
540 540
         }
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         $metaData      = $this->di->get('modelsMetadata');
551 551
         $defaultValues = $metaData->getDefaultValues($this);
552 552
         foreach ($defaultValues as $field => $value) {
553
-            if ( ! isset($this->{$field})) {
553
+            if (!isset($this->{$field})) {
554 554
                 $this->{$field} = $value;
555 555
             }
556 556
         }
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
                 = $currentDeleteRecord->_modelsManager->getRelations(get_class($currentDeleteRecord));
685 685
         foreach ($relations as $relation) {
686 686
             $foreignKey = $relation->getOption('foreignKey');
687
-            if ( ! array_key_exists('action', $foreignKey)) {
687
+            if (!array_key_exists('action', $foreignKey)) {
688 688
                 continue;
689 689
             }
690 690
             // Check if there are some record which restrict delete current record
@@ -702,10 +702,10 @@  discard block
 block discarded – undo
702 702
                     ? ' OR ' : '';
703 703
                 $parameters['conditions']             .= $referencedField
704 704
                     . '= :field'
705
-                    . $index . ':';
705
+                    . $index.':';
706 706
                 $bindField
707 707
                                                       = $mappedFields[$index];
708
-                $parameters['bind']['field' . $index] = $currentDeleteRecord->$bindField;
708
+                $parameters['bind']['field'.$index] = $currentDeleteRecord->$bindField;
709 709
             }
710 710
             $relatedRecords = $relatedModel::find($parameters);
711 711
             switch ($foreignKey['action']) {
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
     private function processSettingsChanges(string $action): void
779 779
     {
780 780
         if (php_sapi_name() !== 'cli') {
781
-            if ( ! $this->hasSnapshotData()) {
781
+            if (!$this->hasSnapshotData()) {
782 782
                 return;
783 783
             } // nothing changed
784 784
 
Please login to merge, or discard this patch.
src/Modules/PbxExtensionState.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
         $this->moduleUniqueID = $moduleUniqueID;
42 42
         $this->modulesRoot    = $this->getDI()->getShared('config')->path('core.modulesDir');
43 43
         $moduleJson           = "{$this->modulesRoot}/{$this->moduleUniqueID}/module.json";
44
-        if ( ! file_exists($moduleJson)) {
45
-            $this->messages[] = 'module.json not found for module ' . $this->moduleUniqueID;
44
+        if (!file_exists($moduleJson)) {
45
+            $this->messages[] = 'module.json not found for module '.$this->moduleUniqueID;
46 46
 
47 47
             return;
48 48
         }
49 49
 
50 50
         $jsonString            = file_get_contents($moduleJson);
51 51
         $jsonModuleDescription = json_decode($jsonString, true);
52
-        if ( ! is_array($jsonModuleDescription)) {
53
-            $this->messages[] = 'module.json parsing error ' . $this->moduleUniqueID;
52
+        if (!is_array($jsonModuleDescription)) {
53
+            $this->messages[] = 'module.json parsing error '.$this->moduleUniqueID;
54 54
 
55 55
             return;
56 56
         }
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
             }
94 94
         }
95 95
         $success = $this->makeBeforeEnableTest();
96
-        if ( ! $success) {
96
+        if (!$success) {
97 97
             return false;
98 98
         }
99 99
 
100 100
         $this->reloadConfigClass();
101 101
         // Если ошибок нет, включаем Firewall и модуль
102
-        if ( ! $this->enableFirewallSettings()) {
102
+        if (!$this->enableFirewallSettings()) {
103 103
             $this->messages[] = 'Error on enable firewall settings';
104 104
 
105 105
             return false;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                 if (array_key_exists($network->id, $previousRules)) {
181 181
                     $newRule->action = $previousRules[$network->id];
182 182
                 }
183
-                if ( ! $newRule->save()) {
183
+                if (!$newRule->save()) {
184 184
                     $this->messages[] = $newRule->getMessages();
185 185
                 }
186 186
             }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     {
208 208
         if ($this->configClass !== null
209 209
             && method_exists($this->configClass, 'createNginxLocations')
210
-            && ! empty($this->configClass->createNginxLocations())) {
210
+            && !empty($this->configClass->createNginxLocations())) {
211 211
             $nginxConf = new NginxConf();
212 212
             $nginxConf->generateModulesConf();
213 213
             $nginxConf->reStart();
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     {
225 225
         if ($this->configClass !== null
226 226
             && method_exists($this->configClass, 'generateFail2BanJails')
227
-            && ! empty($this->configClass->generateFail2BanJails())) {
227
+            && !empty($this->configClass->generateFail2BanJails())) {
228 228
             IptablesConf::reloadFirewall();
229 229
         }
230 230
     }
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
     public function disableModule(): bool
237 237
     {
238 238
         $success = $this->makeBeforeDisableTest();
239
-        if ( ! $success) {
239
+        if (!$success) {
240 240
             return false;
241 241
         }
242 242
         $this->reloadConfigClass();
243 243
         // Если ошибок нет, выключаем Firewall и модуль
244
-        if ( ! $this->disableFirewallSettings()) {
244
+        if (!$this->disableFirewallSettings()) {
245 245
             $this->messages[] = 'Error on disable firewall settings';
246 246
 
247 247
             return false;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             && method_exists($this->configClass, 'onBeforeModuleDisable')
301 301
             && $this->configClass->onBeforeModuleDisable() === false) {
302 302
             $messages = $this->configClass->getMessages();
303
-            if ( ! empty($messages)) {
303
+            if (!empty($messages)) {
304 304
                 $this->messages = $messages;
305 305
             } else {
306 306
                 $this->messages[] = 'Error on the Module enable function at onBeforeModuleDisable';
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
             $className        = pathinfo($file)['filename'];
319 319
             $moduleModelClass = "\\Modules\\{$this->moduleUniqueID}\\Models\\{$className}";
320 320
             try {
321
-                if ( ! class_exists($moduleModelClass)) {
321
+                if (!class_exists($moduleModelClass)) {
322 322
                     continue;
323 323
                 }
324 324
                 $reflection = new ReflectionClass($moduleModelClass);
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
                 }
331 331
                 $records = $moduleModelClass::find();
332 332
                 foreach ($records as $record) {
333
-                    if ( ! $record->beforeDelete()) {
333
+                    if (!$record->beforeDelete()) {
334 334
                         foreach ($record->getMessages() as $message) {
335 335
                             $this->messages[] = $message->getMessage();
336 336
                         }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             $savedState[$detailRule->networkfilterid] = $detailRule->action;
383 383
         }
384 384
         $this->db->begin(true);
385
-        if ( ! $currentRules->delete()) {
385
+        if (!$currentRules->delete()) {
386 386
             $this->messages[] = $currentRules->getMessages();
387 387
 
388 388
             return false;
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             $previousRuleSettings->key = "{$this->moduleUniqueID}FirewallSettings";
395 395
         }
396 396
         $previousRuleSettings->value = json_encode($savedState);
397
-        if ( ! $previousRuleSettings->save()) {
397
+        if (!$previousRuleSettings->save()) {
398 398
             $this->messages[] = $previousRuleSettings->getMessages();
399 399
         }
400 400
         if (count($errors) > 0) {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
             && method_exists($this->configClass, 'onBeforeModuleEnable')
448 448
             && $this->configClass->onBeforeModuleEnable() === false) {
449 449
             $messages = $this->configClass->getMessages();
450
-            if ( ! empty($messages)) {
450
+            if (!empty($messages)) {
451 451
                 $this->messages = $messages;
452 452
             } else {
453 453
                 $this->messages[] = 'Error on the enableModule function at onBeforeModuleEnable';
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
             $moduleModelClass = "\\Modules\\{$this->moduleUniqueID}\\Models\\{$className}";
468 468
 
469 469
             try {
470
-                if ( ! class_exists($moduleModelClass)) {
470
+                if (!class_exists($moduleModelClass)) {
471 471
                     continue;
472 472
                 }
473 473
                 $reflection = new ReflectionClass($moduleModelClass);
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                                     'modulename' => $record->getRepresent(true),
498 498
                                 ]
499 499
                             );
500
-                            $success          = false;
500
+                            $success = false;
501 501
                         }
502 502
                     }
503 503
                 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     private function reloadConfigClass(): void
70 70
     {
71 71
         $class_name      = str_replace('Module', '', $this->moduleUniqueID);
72
-        $configClassName = "\\Modules\\{$this->moduleUniqueID}\\Lib\\{$class_name}Conf";
72
+        $configClassName = "\\Modules\\{$this->moduleUniqueID}\\Lib\\{$class_name}conf";
73 73
         if (class_exists($configClassName)) {
74 74
             $this->configClass = new $configClassName();
75 75
         } else {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         $this->db->begin(true);
153 153
         $defaultRules         = $this->configClass->getDefaultFirewallRules();
154
-        $previousRuleSettings = PbxSettings::findFirstByKey("{$this->moduleUniqueID}FirewallSettings");
154
+        $previousRuleSettings = PbxSettings::findFirstByKey("{$this->moduleUniqueID}firewallsettings");
155 155
         $previousRules        = [];
156 156
         if ($previousRuleSettings !== null) {
157 157
             $previousRules = json_decode($previousRuleSettings->value, true);
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
             return false;
389 389
         }
390 390
 
391
-        $previousRuleSettings = PbxSettings::findFirstByKey("{$this->moduleUniqueID}FirewallSettings");
391
+        $previousRuleSettings = PbxSettings::findFirstByKey("{$this->moduleUniqueID}firewallsettings");
392 392
         if ($previousRuleSettings === null) {
393 393
             $previousRuleSettings      = new PbxSettings();
394
-            $previousRuleSettings->key = "{$this->moduleUniqueID}FirewallSettings";
394
+            $previousRuleSettings->key = "{$this->moduleUniqueID}firewallsettings";
395 395
         }
396 396
         $previousRuleSettings->value = json_encode($savedState);
397 397
         if ( ! $previousRuleSettings->save()) {
Please login to merge, or discard this patch.
src/Modules/PbxExtensionUtils.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $moduleAgiBinDir = "{$moduleDir}/agi-bin";
115 115
         $files           = glob("$moduleAgiBinDir/*.{php}", GLOB_BRACE);
116 116
         foreach ($files as $file) {
117
-            $newFilename = $agiBinDir . '/' . basename($file);
117
+            $newFilename = $agiBinDir.'/'.basename($file);
118 118
             Util::createUpdateSymlink($file, $newFilename);
119 119
         }
120 120
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             $needDisable = false;
136 136
             $moduleDir   = PbxExtensionUtils::getModuleDir($module['uniqid']);
137 137
             $moduleJson  = "{$moduleDir}/module.json";
138
-            if ( ! file_exists($moduleJson)) {
138
+            if (!file_exists($moduleJson)) {
139 139
                 $needDisable = true;
140 140
             }
141 141
             $jsonString            = file_get_contents($moduleJson);
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
                 } catch (ErrorAlias $exception) {
152 152
                     Util::sysLogMsg(__CLASS__, "Can not disable module {$module['uniqid']} Message: {$exception}");
153 153
                 } finally {
154
-                    $currentModule           = PbxExtensionModules::findFirstByUniqid($module['uniqid']);
155
-                    if ($currentModule->disabled==='0'){
154
+                    $currentModule = PbxExtensionModules::findFirstByUniqid($module['uniqid']);
155
+                    if ($currentModule->disabled === '0') {
156 156
                         $currentModule->disabled = '1';
157 157
                         $currentModule->update();
158 158
                     }
Please login to merge, or discard this patch.
src/Core/System/Upgrade/Releases/UpdateConfigsUpToVer20202730.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             'slin'  => 'Signed Linear PCM',
79 79
             'opus'  => 'Opus',
80 80
         ];
81
-        $codecs      = Codecs::find();
81
+        $codecs = Codecs::find();
82 82
         // Удалим лишние кодеки
83 83
         /** @var Codecs $codec */
84 84
         foreach ($codecs as $codec) {
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
                 $this->checkDisabledCodec($codec);
87 87
                 continue;
88 88
             }
89
-            if ( ! $codec->delete()) {
89
+            if (!$codec->delete()) {
90 90
                 Util::sysLogMsg(
91 91
                     __CLASS__,
92
-                    'Can not delete codec ' . $codec->name . ' from MikoPBX\Common\Models\Codecs'
92
+                    'Can not delete codec '.$codec->name.' from MikoPBX\Common\Models\Codecs'
93 93
                 );
94 94
             }
95 95
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     private function checkDisabledCodec(Codecs $codec): void
106 106
     {
107
-        if ( ! in_array($codec->disabled, ['0', '1'], true)) {
107
+        if (!in_array($codec->disabled, ['0', '1'], true)) {
108 108
             $codec->disabled = '0';
109 109
             $codec->save();
110 110
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     private function addNewCodecs($availCodecs): void
119 119
     {
120 120
         foreach ($availCodecs as $availCodec => $desc) {
121
-            $codecData = Codecs::findFirst('name="' . $availCodec . '"');
121
+            $codecData = Codecs::findFirst('name="'.$availCodec.'"');
122 122
             if ($codecData === null) {
123 123
                 $codecData = new Codecs();
124 124
             } elseif ($codecData->description === $desc) {
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
             }
134 134
             $codecData->type        = $type;
135 135
             $codecData->description = $desc;
136
-            if ( ! $codecData->save()) {
136
+            if (!$codecData->save()) {
137 137
                 Util::sysLogMsg(
138 138
                     __CLASS__,
139
-                    'Can not update codec info ' . $codecData->name . ' from \MikoPBX\Common\Models\Codecs'
139
+                    'Can not update codec info '.$codecData->name.' from \MikoPBX\Common\Models\Codecs'
140 140
                 );
141 141
             }
142 142
         }
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
         $astDbPath = $this->config->path('astDatabase.dbfile');
189 189
         if (file_exists($astDbPath)) {
190 190
             $table = 'astdb';
191
-            $sql   = 'DELETE FROM ' . $table . ' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"';
191
+            $sql   = 'DELETE FROM '.$table.' WHERE key LIKE "/DND/SIP%" OR key LIKE "/CF/SIP%" OR key LIKE "/UserBuddyStatus/SIP%"';
192 192
             $db    = new \SQLite3($astDbPath);
193 193
             try {
194 194
                 $db->exec($sql);
195 195
             } catch (\Error $e) {
196
-                Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...' . $e->getMessage());
196
+                Util::sysLogMsg(__CLASS__, 'Can clean astdb from UserBuddyStatus...'.$e->getMessage());
197 197
                 sleep(2);
198 198
             }
199 199
             $db->close();
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
      */
207 207
     private function copyMohFilesToStorage(): void
208 208
     {
209
-        $oldMohDir = $this->config->path('asterisk.astvarlibdir') . '/sounds/moh';
210
-        if ( ! file_exists($oldMohDir)) {
209
+        $oldMohDir = $this->config->path('asterisk.astvarlibdir').'/sounds/moh';
210
+        if (!file_exists($oldMohDir)) {
211 211
             return;
212 212
         }
213 213
         $currentMohDir = $this->config->path('asterisk.mohdir');
214
-        if ( ! Util::mwMkdir($currentMohDir)) {
214
+        if (!Util::mwMkdir($currentMohDir)) {
215 215
             return;
216 216
         }
217 217
 
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
             if (in_array($file, ['.', '..'])) {
221 221
                 continue;
222 222
             }
223
-            if (copy($oldMohDir . '/' . $file, $currentMohDir . '/' . $file)) {
223
+            if (copy($oldMohDir.'/'.$file, $currentMohDir.'/'.$file)) {
224 224
                 $sound_file           = new SoundFiles();
225
-                $sound_file->path     = $currentMohDir . '/' . $file;
225
+                $sound_file->path     = $currentMohDir.'/'.$file;
226 226
                 $sound_file->category = SoundFiles::CATEGORY_MOH;
227 227
                 $sound_file->name     = $file;
228 228
                 $sound_file->save();
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
             Extensions::TYPE_CONFERENCE,
287 287
 
288 288
         ];
289
-        $extensions           = Extensions::find();
289
+        $extensions = Extensions::find();
290 290
         foreach ($extensions as $extension) {
291 291
             if (in_array($extension->type, $showInPhonebookTypes)) {
292 292
                 $extension->show_in_phonebook = '1';
@@ -301,14 +301,14 @@  discard block
 block discarded – undo
301 301
      */
302 302
     private function moveReadOnlySoundsToStorage(): void
303 303
     {
304
-        $currentMediaDir = $this->config->path('asterisk.customSoundDir') . '/';
305
-        if ( ! is_dir($currentMediaDir)) {
304
+        $currentMediaDir = $this->config->path('asterisk.customSoundDir').'/';
305
+        if (!is_dir($currentMediaDir)) {
306 306
             Util::mwMkdir($currentMediaDir);
307 307
         }
308 308
         $soundFiles = SoundFiles::find();
309 309
         foreach ($soundFiles as $soundFile) {
310 310
             if (stripos($soundFile->path, '/offload/asterisk/sounds/other/') === 0) {
311
-                $newPath = $currentMediaDir . pathinfo($soundFile->path)['basename'];
311
+                $newPath = $currentMediaDir.pathinfo($soundFile->path)['basename'];
312 312
                 if (copy($soundFile->path, $newPath)) {
313 313
                     $soundFile->path = $newPath;
314 314
                     $soundFile->update();
Please login to merge, or discard this patch.