Passed
Push — master ( 15b19d...384de0 )
by Nikolay
11:50 queued 06:02
created
src/Core/System/Upgrade/UpdateDatabase.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             $moduleModelClass = "MikoPBX\\Common\\Models\\{$className}";
67 67
             try {
68 68
                 $this->createUpdateDbTableByAnnotations($moduleModelClass);
69
-            } catch (Error $exception){
69
+            } catch (Error $exception) {
70 70
                 Util::echoWithSyslog('Errors within update table '.$className.' '.$exception->getMessage());
71 71
             }
72 72
         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $result = true;
87 87
         if (
88
-            ! class_exists($modelClassName)
88
+            !class_exists($modelClassName)
89 89
             || count(get_class_vars($modelClassName)) === 0) {
90 90
             return true;
91 91
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 'isNumeric' => false,
126 126
                 'primary'   => false,
127 127
             ];
128
-            $previousAttribute           = $attribute;
128
+            $previousAttribute = $attribute;
129 129
         }
130 130
 
131 131
         // Set data types
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 
234 234
         $connectionService->begin();
235 235
 
236
-        if ( ! $connectionService->tableExists($tableName)) {
237
-            Util::echoWithSyslog(' - UpdateDatabase: Create new table: ' . $tableName . ' ');
236
+        if (!$connectionService->tableExists($tableName)) {
237
+            Util::echoWithSyslog(' - UpdateDatabase: Create new table: '.$tableName.' ');
238 238
             $result = $connectionService->createTable($tableName, '', $columnsNew);
239 239
             Util::echoGreenDone();
240 240
         } else {
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             $currentColumnsArr = $connectionService->describeColumns($tableName, '');
243 243
 
244 244
             if ($this->isTableStructureNotEqual($currentColumnsArr, $columns)) {
245
-                Util::echoWithSyslog(' - UpdateDatabase: Upgrade table: ' . $tableName . ' ');
245
+                Util::echoWithSyslog(' - UpdateDatabase: Upgrade table: '.$tableName.' ');
246 246
                 // Create new table and copy all data
247 247
                 $currentStateColumnList = [];
248 248
                 $oldColNames            = []; // Старые названия колонок
@@ -332,13 +332,13 @@  discard block
 block discarded – undo
332 332
                 if ($oldField->$compared_setting() !== $newField->$compared_setting()) {
333 333
                     // Sqlite transform "1" to ""1"" in default settings, but it is normal
334 334
                     if ($compared_setting === 'getDefault'
335
-                        && $oldField->$compared_setting() === '"' . $newField->$compared_setting() . '"') {
335
+                        && $oldField->$compared_setting() === '"'.$newField->$compared_setting().'"') {
336 336
                         continue;
337 337
                     }
338 338
 
339 339
                     // Description for "length" is integer, but table structure store it as string
340 340
                     if ($compared_setting === 'getSize'
341
-                        && (string)$oldField->$compared_setting() === (string)$newField->$compared_setting()) {
341
+                        && (string) $oldField->$compared_setting() === (string) $newField->$compared_setting()) {
342 342
                         continue;
343 343
                     }
344 344
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
         // Drop not exist indexes
367 367
         foreach ($currentIndexes as $indexName => $currentIndex) {
368 368
             if (stripos($indexName, 'sqlite_autoindex') === false
369
-                && ! array_key_exists($indexName, $indexes)
369
+                && !array_key_exists($indexName, $indexes)
370 370
             ) {
371 371
                 Util::echoWithSyslog(" - UpdateDatabase: Delete index: {$indexName} ");
372 372
                 $result = $result + $connectionService->dropIndex($tableName, '', $indexName);
Please login to merge, or discard this patch.
src/PBXCoreREST/Workers/WorkerMakeLogFilesArchive.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@
 block discarded – undo
19 19
     public function start($argv): void
20 20
     {
21 21
         $settings_file = trim($argv[1]);
22
-        if ( ! file_exists($settings_file)) {
22
+        if (!file_exists($settings_file)) {
23 23
             Util::sysLogMsg("WorkerMakeLogFilesArchive", 'File with settings not found');
24 24
             return;
25 25
         }
26 26
         $file_data = json_decode(file_get_contents($settings_file), true);
27
-        if ( ! isset($file_data['result_file'])) {
27
+        if (!isset($file_data['result_file'])) {
28 28
             Util::sysLogMsg("WorkerMakeLogFilesArchive", 'Wrong settings');
29 29
             return;
30 30
         }
Please login to merge, or discard this patch.
src/Core/System/SentryErrorLogger.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
             SentrySdk::init()->bindClient($client);
67 67
 
68 68
             SentrySdk::getCurrentHub()->configureScope(
69
-                function (Scope $scope): void {
69
+                function(Scope $scope): void {
70 70
                     if (isset($this->email)) {
71 71
                         $scope->setUser(['id' => $this->email], true);
72 72
                     }
Please login to merge, or discard this patch.
src/AdminCabinet/Library/LanguageSelector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
         if (($list = strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']))) {
21 21
             if (preg_match_all('/([a-z]{1,8}(?:-[a-z]{1,8})?)(?:;q=([0-9.]+))?/', $list, $list)) {
22 22
                 $language = array_combine($list[1], $list[2]);
23
-                if (is_array($language)){
23
+                if (is_array($language)) {
24 24
                     foreach ($language as $n => $v) {
25 25
                         $this->language[$n] = $v ? $v : 1;
26 26
                     }
Please login to merge, or discard this patch.
src/Core/Workers/WorkerLogRotate.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $managedCache = $this->di->get('managedCache');
29 29
         $lastLogRotate = $managedCache->get('lastCoreWorkerLogRotateProcessing');
30
-        if ($lastLogRotate===null){
30
+        if ($lastLogRotate === null) {
31 31
             //System Logs
32 32
             NatsConf::logRotate();
33 33
             PHPConf::rotateLog();
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function logRotate(string $moduleUniqid): void
51 51
     {
52
-        $logPath        = System::getLogDir() . '/' . $moduleUniqid . '/';
53
-        if ( ! file_exists($logPath)) {
52
+        $logPath = System::getLogDir().'/'.$moduleUniqid.'/';
53
+        if (!file_exists($logPath)) {
54 54
             return;
55 55
         }
56 56
 
57
-        $results         = glob($logPath . '*.log', GLOB_NOSORT);
57
+        $results         = glob($logPath.'*.log', GLOB_NOSORT);
58 58
         $textConfig = '';
59 59
         foreach ($results as $file) {
60
-            $textConfig .= $file . ' {
60
+            $textConfig .= $file.' {
61 61
     start 0
62 62
     rotate 9
63 63
     size 10M
Please login to merge, or discard this patch.
src/Core/System/Util.php 3 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
     {
377 377
         if($events === 'on'){
378 378
             $nameService = 'amiListner';
379
-        }else{
379
+        } else{
380 380
             $nameService = 'amiCommander';
381 381
         }
382 382
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
         for ($i = 0; $i < $length; $i++) {
407 407
             try {
408 408
                 $randomString .= $characters[random_int(0, $charactersLength - 1)];
409
-            }catch (\Exception $e ){
409
+            } catch (\Exception $e ){
410 410
                 $randomString = '';
411 411
             }
412 412
         }
@@ -991,7 +991,8 @@  discard block
 block discarded – undo
991 991
      *
992 992
      * @return array
993 993
      */
994
-    public static function flattenArray(array $array) {
994
+    public static function flattenArray(array $array)
995
+    {
995 996
         $result = [];
996 997
         foreach ($array as $value) {
997 998
             if (is_array($value)) {
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -262,32 +262,32 @@  discard block
 block discarded – undo
262 262
 
263 263
         $WorkerPID = self::getPidOfProcess($proc_name);
264 264
 
265
-         switch ($action) {
266
-             case 'status':
265
+            switch ($action) {
266
+                case 'status':
267 267
                  $status = ($WorkerPID !== '') ? 'Started' : 'Stoped';
268
-                 return ['status' => $status, 'app' => $proc_name, 'PID' => $WorkerPID];
269
-             case 'restart':
268
+                    return ['status' => $status, 'app' => $proc_name, 'PID' => $WorkerPID];
269
+                case 'restart':
270 270
                  // Firstly start new process
271 271
                  self::mwExec("{$path_nohup} {$cmd} {$param}  > {$out_file} 2>&1 &");
272
-                 // Then kill the old one
273
-                 if ($WorkerPID !== '') {
274
-                     self::mwExec("{$path_kill} -9 {$WorkerPID}  > /dev/null 2>&1 &");
275
-                 }
276
-                 break;
277
-             case 'stop':
272
+                    // Then kill the old one
273
+                    if ($WorkerPID !== '') {
274
+                        self::mwExec("{$path_kill} -9 {$WorkerPID}  > /dev/null 2>&1 &");
275
+                    }
276
+                    break;
277
+                case 'stop':
278 278
                  if ($WorkerPID !== '') {
279
-                     self::mwExec("{$path_kill} -9 {$WorkerPID}  > /dev/null 2>&1 &");
280
-                 }
281
-                 break;
282
-             case 'start':
279
+                        self::mwExec("{$path_kill} -9 {$WorkerPID}  > /dev/null 2>&1 &");
280
+                    }
281
+                    break;
282
+                case 'start':
283 283
                  if ($WorkerPID === '') {
284
-                     self::mwExec("{$path_nohup} {$cmd} {$param}  > {$out_file} 2>&1 &");
285
-                 }
286
-                 break;
287
-             case 'multiStart':
284
+                        self::mwExec("{$path_nohup} {$cmd} {$param}  > {$out_file} 2>&1 &");
285
+                    }
286
+                    break;
287
+                case 'multiStart':
288 288
                  self::mwExec("{$path_nohup} {$cmd} {$param}  > {$out_file} 2>&1 &");
289
-                 break;
290
-             default:
289
+                    break;
290
+                default:
291 291
          }
292 292
 
293 293
         return true;
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
         $variable = "_IS_ORGNT={$IS_ORGNT},pt1c_cid={$dest_number},_extenfrom1c={$peer_number},__peer_mobile={$peer_mobile},_FROM_PEER={$peer_number}";
376 376
 
377 377
         return $am->Originate($channel,
378
-                              $dest_number,
379
-                              $context,
380
-                      '1', null, null, null, null, $variable, null, true);
378
+                                $dest_number,
379
+                                $context,
380
+                        '1', null, null, null, null, $variable, null, true);
381 381
     }
382 382
 
383 383
     /**
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             }
45 45
             if (is_array($value)) {
46 46
                 array_unshift($value, ' ');
47
-                $result_config .= trim(implode("\n{$key} = ", $value)) . "\n";
47
+                $result_config .= trim(implode("\n{$key} = ", $value))."\n";
48 48
             } else {
49 49
                 $result_config .= "{$key} = {$value}\n";
50 50
             }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $killallPath = self::which('killall');
66 66
 
67
-        return self::mwExec($killallPath . ' ' . escapeshellarg($procName));
67
+        return self::mwExec($killallPath.' '.escapeshellarg($procName));
68 68
     }
69 69
 
70 70
     /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public static function mwExec($command, &$outArr = null, &$retVal = null): int
80 80
     {
81 81
         $retVal = 0;
82
-        $outArr   = [];
82
+        $outArr = [];
83 83
         $di     = Di::getDefault();
84 84
 
85 85
         if ($di !== null && $di->getShared('config')->path('core.debugMode')) {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $rmPath    = self::which('rm');
106 106
         $sleepPath = self::which('sleep');
107 107
         if ($sleep_time > 0) {
108
-            $filename = '/tmp/' . time() . '_noop.sh';
108
+            $filename = '/tmp/'.time().'_noop.sh';
109 109
             file_put_contents($filename, "{$sleepPath} {$sleep_time}; {$command}; {$rmPath} -rf {$filename}");
110 110
             $noop_command = "{$nohupPath} {$shPath} {$filename} > {$out_file} 2>&1 &";
111 111
         } else {
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
      *
168 168
      * @return bool
169 169
      */
170
-    public static function mwMkdir(string $parameters, bool $addWWWRights=false): bool
170
+    public static function mwMkdir(string $parameters, bool $addWWWRights = false): bool
171 171
     {
172 172
         $result = true;
173 173
         if (posix_getuid() === 0) {
174 174
             $arrPaths = explode(' ', $parameters);
175 175
             if (count($arrPaths) > 0) {
176 176
                 foreach ($arrPaths as $path) {
177
-                    if ( ! empty($path)
178
-                        && ! file_exists($path)
179
-                        && ! mkdir($path, 0755, true)
180
-                        && ! is_dir($path)) {
177
+                    if (!empty($path)
178
+                        && !file_exists($path)
179
+                        && !mkdir($path, 0755, true)
180
+                        && !is_dir($path)) {
181 181
                         $result = false;
182 182
                         self::sysLogMsg('Util', 'Error on create folder '.$path);
183 183
                     }
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
      * @param string $param
198 198
      * @param string $action
199 199
      */
200
-    public static function processPHPWorker(string $className, string $param = 'start', string $action='restart'): void
200
+    public static function processPHPWorker(string $className, string $param = 'start', string $action = 'restart'): void
201 201
     {
202 202
         $workerPath = self::getFilePathByClassName($className);
203
-        if ( ! empty($workerPath)) {
203
+        if (!empty($workerPath)) {
204 204
             $command = "php -f {$workerPath}";
205 205
             self::processWorker($command, $param, $className, $action);
206 206
         }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             $reflection = new ReflectionClass($className);
222 222
             $filename   = $reflection->getFileName();
223 223
         } catch (\ReflectionException $exception) {
224
-            self::sysLogMsg('Util', 'Error ' . $exception->getMessage());
224
+            self::sysLogMsg('Util', 'Error '.$exception->getMessage());
225 225
         }
226 226
 
227 227
         return $filename;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @param ?int $level
236 236
      * @param ?int $facility
237 237
      */
238
-    public static function sysLogMsg($log_name, $text, $level = null, $facility=LOG_AUTH): void
238
+    public static function sysLogMsg($log_name, $text, $level = null, $facility = LOG_AUTH): void
239 239
     {
240 240
         $level = ($level === null) ? LOG_WARNING : $level;
241 241
         openlog("$log_name", LOG_PID | LOG_PERROR, $facility);
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
 
347 347
         $name       = addslashes($name);
348 348
         $filter_cmd = '';
349
-        if ( ! empty($exclude)) {
350
-            $filter_cmd = "| $path_grep -v " . escapeshellarg($exclude);
349
+        if (!empty($exclude)) {
350
+            $filter_cmd = "| $path_grep -v ".escapeshellarg($exclude);
351 351
         }
352 352
         $out = [];
353 353
         self::mwExec(
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     public static function amiOriginate($peer_number, $peer_mobile, $dest_number): array
370 370
     {
371 371
         $am       = self::getAstManager('off');
372
-        $channel  = 'Local/' . $peer_number . '@internal-originate';
372
+        $channel  = 'Local/'.$peer_number.'@internal-originate';
373 373
         $context  = 'all_peers';
374 374
         $IS_ORGNT = self::generateRandomString();
375 375
         $variable = "_IS_ORGNT={$IS_ORGNT},pt1c_cid={$dest_number},_extenfrom1c={$peer_number},__peer_mobile={$peer_mobile},_FROM_PEER={$peer_number}";
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
      */
390 390
     public static function getAstManager($events = 'on'): AsteriskManager
391 391
     {
392
-        if($events === 'on'){
392
+        if ($events === 'on') {
393 393
             $nameService = 'amiListner';
394
-        }else{
394
+        } else {
395 395
             $nameService = 'amiCommander';
396 396
         }
397 397
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         for ($i = 0; $i < $length; $i++) {
418 418
             try {
419 419
                 $randomString .= $characters[random_int(0, $charactersLength - 1)];
420
-            }catch (\Exception $e ){
420
+            } catch (\Exception $e) {
421 421
                 $randomString = '';
422 422
             }
423 423
         }
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
     public static function getExtensionOfFile($filename)
598 598
     {
599 599
         $path_parts = pathinfo($filename);
600
-        return $path_parts['extension']??'';
600
+        return $path_parts['extension'] ?? '';
601 601
     }
602 602
 
603 603
     /**
@@ -611,10 +611,10 @@  discard block
 block discarded – undo
611 611
     public static function trimExtensionForFile($filename, $delimiter = '.'): string
612 612
     {
613 613
         // Отсечем расширение файла.
614
-        $tmp_arr = explode((string)$delimiter, $filename);
614
+        $tmp_arr = explode((string) $delimiter, $filename);
615 615
         if (count($tmp_arr) > 1) {
616 616
             unset($tmp_arr[count($tmp_arr) - 1]);
617
-            $filename = implode((string)$delimiter, $tmp_arr);
617
+            $filename = implode((string) $delimiter, $tmp_arr);
618 618
         }
619 619
 
620 620
         return $filename;
@@ -686,14 +686,14 @@  discard block
 block discarded – undo
686 686
             $objects = scandir($dir);
687 687
             foreach ($objects as $object) {
688 688
                 if ($object != "." && $object != "..") {
689
-                    if (filetype($dir . "/" . $object) == "dir") {
690
-                        self::rRmDir($dir . "/" . $object);
689
+                    if (filetype($dir."/".$object) == "dir") {
690
+                        self::rRmDir($dir."/".$object);
691 691
                     } else {
692
-                        unlink($dir . "/" . $object);
692
+                        unlink($dir."/".$object);
693 693
                     }
694 694
                 }
695 695
             }
696
-            if($objects !== false){
696
+            if ($objects !== false) {
697 697
                 reset($objects);
698 698
             }
699 699
             rmdir($dir);
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
     public static function generateSslCert($options = null, $config_args_pkey = null, $config_args_csr = null): array
713 713
     {
714 714
         // Инициализация настроек.
715
-        if ( ! $options) {
715
+        if (!$options) {
716 716
             $options = [
717 717
                 "countryName"            => 'RU',
718 718
                 "stateOrProvinceName"    => 'Moscow',
@@ -724,11 +724,11 @@  discard block
 block discarded – undo
724 724
             ];
725 725
         }
726 726
 
727
-        if ( ! $config_args_csr) {
727
+        if (!$config_args_csr) {
728 728
             $config_args_csr = ['digest_alg' => 'sha256'];
729 729
         }
730 730
 
731
-        if ( ! $config_args_pkey) {
731
+        if (!$config_args_pkey) {
732 732
             $config_args_pkey = [
733 733
                 "private_key_bits" => 2048,
734 734
                 "private_key_type" => OPENSSL_KEYTYPE_RSA,
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
             $row = trim($row);
875 875
             $pos = strpos($row, ']');
876 876
             if ($pos !== false && strpos($row, '[') === 0) {
877
-                $row = "\n" . substr($row, 0, $pos);
877
+                $row = "\n".substr($row, 0, $pos);
878 878
             }
879 879
         }
880 880
         unset($row);
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
         foreach ($sections as $section) {
887 887
             $data_rows    = explode("\n", trim($section));
888 888
             $section_name = trim($data_rows[0] ?? '');
889
-            if ( ! empty($section_name)) {
889
+            if (!empty($section_name)) {
890 890
                 unset($data_rows[0]);
891 891
                 $manual_data[$section_name] = [];
892 892
                 foreach ($data_rows as $row) {
Please login to merge, or discard this patch.
src/AdminCabinet/Forms/SystemDiagnosticForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
         $this->add($filenames);
33 33
 
34 34
         $this->add(new Text('filter', ['value' => '']));
35
-        $this->add(new Numeric('lines',  ['value' => '500']));
36
-        $this->add(new Numeric('offset',  ['value' => '0']));
35
+        $this->add(new Numeric('lines', ['value' => '500']));
36
+        $this->add(new Numeric('offset', ['value' => '0']));
37 37
 
38 38
     }
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
src/AdminCabinet/Controllers/ExtensionsController.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -215,11 +215,11 @@
 block discarded – undo
215 215
 
216 216
         $form = new ExtensionEditForm(
217 217
             $extension, [
218
-                          'network_filters'        => $arrNetworkFilters,
219
-                          'external_extension'     => $externalExtension,
220
-                          'forwarding_extensions'  => $forwardingExtensions,
221
-                          'internalextension_mask' => $internalExtensionMask,
222
-                      ]
218
+                            'network_filters'        => $arrNetworkFilters,
219
+                            'external_extension'     => $externalExtension,
220
+                            'forwarding_extensions'  => $forwardingExtensions,
221
+                            'internalextension_mask' => $internalExtensionMask,
222
+                        ]
223 223
         );
224 224
 
225 225
         $this->view->form      = $form;
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
                     $extensionTable[$extension->userid]['email']    = $extension->email;
81 81
                     $extensionTable[$extension->userid]['secret']   = $extension->secret;
82 82
 
83
-                    if ( ! array_key_exists('mobile', $extensionTable[$extension->userid])) {
83
+                    if (!array_key_exists('mobile', $extensionTable[$extension->userid])) {
84 84
                         $extensionTable[$extension->userid]['mobile'] = '';
85 85
                     }
86 86
                     if ($extension->avatar) {
87 87
                         $filename    = md5($extension->avatar);
88 88
                         $imgCacheDir = appPath('sites/admin-cabinet/assets/img/cache');
89 89
                         $imgFile     = "{$imgCacheDir}/$filename.jpg";
90
-                        if ( ! file_exists($imgFile)) {
90
+                        if (!file_exists($imgFile)) {
91 91
                             $this->base64ToJpeg($extension->avatar, $imgFile);
92 92
                         }
93 93
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             $extension->Sip                    = new Sip();
153 153
             $extension->Sip->disabled          = 0;
154 154
             $extension->Sip->type              = 'peer';
155
-            $extension->Sip->uniqid            = Extensions::TYPE_SIP.strtoupper('-PHONE-' . md5(time()));
155
+            $extension->Sip->uniqid            = Extensions::TYPE_SIP.strtoupper('-PHONE-'.md5(time()));
156 156
             $extension->Sip->busylevel         = 1;
157 157
             $extension->Sip->qualify           = '1';
158 158
             $extension->Sip->qualifyfreq       = 60;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             $arrNetworkFilters[$filter->id] = $filter->getRepresent();
175 175
         }
176 176
 
177
-        $parameters        = [
177
+        $parameters = [
178 178
             'conditions' => 'type = "'.Extensions::TYPE_EXTERNAL.'" AND is_general_user_number = "1" AND userid=:userid:',
179 179
             'bind'       => [
180 180
                 'userid' => $extension->userid,
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
             $externalExtension->type                     = Extensions::TYPE_EXTERNAL;
188 188
             $externalExtension->is_general_user_number   = '1';
189 189
             $externalExtension->ExternalPhones           = new ExternalPhones();
190
-            $externalExtension->ExternalPhones->uniqid   = Extensions::TYPE_EXTERNAL.strtoupper('-' . md5(time()));
190
+            $externalExtension->ExternalPhones->uniqid   = Extensions::TYPE_EXTERNAL.strtoupper('-'.md5(time()));
191 191
             $externalExtension->ExternalPhones->disabled = '0';
192 192
         }
193 193
 
194
-        $forwardingExtensions  = [];
194
+        $forwardingExtensions = [];
195 195
         $forwardingExtensions[''] = $this->translation->_('ex_SelectNumber');
196 196
 
197 197
         $parameters = [
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
             'conditions' => 'type = "'.Extensions::TYPE_SIP.'"',
236 236
             'column'     => 'number',
237 237
         ];
238
-        $query      = Extensions::maximum($parameters);
238
+        $query = Extensions::maximum($parameters);
239 239
         if ($query === null) {
240 240
             $query = 200;
241 241
         }
242
-        $result       = (int)$query + 1;
242
+        $result       = (int) $query + 1;
243 243
         $extensionsLength = PbxSettings::getValueByKey('PBXInternalExtensionLength');
244 244
         $maxExtension = (10 ** $extensionsLength) - 1;
245 245
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      */
254 254
     public function saveAction(): void
255 255
     {
256
-        if ( ! $this->request->isPost()) {
256
+        if (!$this->request->isPost()) {
257 257
             return;
258 258
         }
259 259
 
@@ -275,21 +275,21 @@  discard block
 block discarded – undo
275 275
             $fwdEntity->ringlength = 45;
276 276
         } else {
277 277
             $extension = $sipEntity->Extensions;
278
-            if ( ! $extension) {
278
+            if (!$extension) {
279 279
                 $extension = new Extensions();
280 280
             }
281 281
             $userEntity = $extension->Users;
282
-            if ( ! $userEntity) {
282
+            if (!$userEntity) {
283 283
                 $userEntity = new Users();
284 284
             }
285 285
             $fwdEntity = $extension->ExtensionForwardingRights;
286
-            if ( ! $fwdEntity) {
286
+            if (!$fwdEntity) {
287 287
                 $fwdEntity = new ExtensionForwardingRights();
288 288
             }
289 289
         }
290 290
 
291 291
         // Заполним параметры пользователя
292
-        if ( ! $this->saveUser($userEntity, $data)) {
292
+        if (!$this->saveUser($userEntity, $data)) {
293 293
             $this->view->success = false;
294 294
             $this->db->rollback();
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
         }
298 298
 
299 299
         // Заполним параметры внутреннего номера
300
-        if ( ! $this->saveExtension($extension, $userEntity, $data, false)) {
300
+        if (!$this->saveExtension($extension, $userEntity, $data, false)) {
301 301
             $this->view->success = false;
302 302
             $this->db->rollback();
303 303
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         }
306 306
 
307 307
         // Заполним параметры SIP учетки
308
-        if ( ! $this->saveSip($sipEntity, $data)) {
308
+        if (!$this->saveSip($sipEntity, $data)) {
309 309
             $this->view->success = false;
310 310
             $this->db->rollback();
311 311
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
 
316 316
         // Заполним параметры маршрутизации
317
-        if ( ! $this->saveForwardingRights($fwdEntity, $data)) {
317
+        if (!$this->saveForwardingRights($fwdEntity, $data)) {
318 318
             $this->view->success = false;
319 319
             $this->db->rollback();
320 320
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         }
323 323
 
324 324
         // Если мобильный не указан, то не будем его добавлять в базу
325
-        if ( ! empty($data['mobile_number'])) {
325
+        if (!empty($data['mobile_number'])) {
326 326
             $externalPhone = ExternalPhones::findFirstByUniqid($data['mobile_uniqid']);
327 327
             if ($externalPhone === null) {
328 328
                 $externalPhone   = new ExternalPhones();
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
             }
333 333
 
334 334
             // Заполним параметры Extension для мобильного
335
-            if ( ! $this->saveExtension($mobileExtension, $userEntity, $data, true)) {
335
+            if (!$this->saveExtension($mobileExtension, $userEntity, $data, true)) {
336 336
                 $this->view->success = false;
337 337
                 $this->db->rollback();
338 338
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             // Заполним параметры ExternalPhones для мобильного
343
-            if ( ! $this->saveExternalPhones($externalPhone, $data)) {
343
+            if (!$this->saveExternalPhones($externalPhone, $data)) {
344 344
                 $this->view->success = false;
345 345
                 $this->db->rollback();
346 346
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             }
349 349
         } else {
350 350
             // Удалить номер мобильного если он был привязан к пользователю
351
-            $parameters          = [
351
+            $parameters = [
352 352
                 'conditions' => 'type="'.Extensions::TYPE_EXTERNAL.'" AND is_general_user_number = "1" AND userid=:userid:',
353 353
                 'bind'       => [
354 354
                     'userid' => $userEntity->id,
@@ -390,13 +390,13 @@  discard block
 block discarded – undo
390 390
         foreach ($userEntity as $name => $value) {
391 391
             switch ($name) {
392 392
                 case 'role':
393
-                    if (array_key_exists('user_' . $name, $data)) {
394
-                        $userEntity->$name = ($userEntity->$name === 'user') ? 'user' : $data['user_' . $name]; // не повышаем роль
393
+                    if (array_key_exists('user_'.$name, $data)) {
394
+                        $userEntity->$name = ($userEntity->$name === 'user') ? 'user' : $data['user_'.$name]; // не повышаем роль
395 395
                     }
396 396
                     break;
397 397
                 default:
398
-                    if (array_key_exists('user_' . $name, $data)) {
399
-                        $userEntity->$name = $data['user_' . $name];
398
+                    if (array_key_exists('user_'.$name, $data)) {
399
+                        $userEntity->$name = $data['user_'.$name];
400 400
                     }
401 401
             }
402 402
         }
@@ -488,20 +488,20 @@  discard block
 block discarded – undo
488 488
                     break;
489 489
                 case 'disabled':
490 490
                 case 'disablefromuser':
491
-                    if (array_key_exists('sip_' . $name, $data)) {
492
-                        $sipEntity->$name = ($data['sip_' . $name] === 'on') ? '1' : '0';
491
+                    if (array_key_exists('sip_'.$name, $data)) {
492
+                        $sipEntity->$name = ($data['sip_'.$name] === 'on') ? '1' : '0';
493 493
                     } else {
494 494
                         $sipEntity->$name = "0";
495 495
                     }
496 496
                     break;
497 497
                 case 'networkfilterid':
498
-                    if ( ! array_key_exists('sip_' . $name, $data)) {
498
+                    if (!array_key_exists('sip_'.$name, $data)) {
499 499
                         continue 2;
500 500
                     }
501
-                    if ($data['sip_' . $name] === 'none') {
501
+                    if ($data['sip_'.$name] === 'none') {
502 502
                         $sipEntity->$name = null;
503 503
                     } else {
504
-                        $sipEntity->$name = $data['sip_' . $name];
504
+                        $sipEntity->$name = $data['sip_'.$name];
505 505
                     }
506 506
                     break;
507 507
                 case 'extension':
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
                     $sipEntity->setManualAttributes($data['sip_manualattributes']);
515 515
                     break;
516 516
                 default:
517
-                    if (array_key_exists('sip_' . $name, $data)) {
518
-                        $sipEntity->$name = $data['sip_' . $name];
517
+                    if (array_key_exists('sip_'.$name, $data)) {
518
+                        $sipEntity->$name = $data['sip_'.$name];
519 519
                     }
520 520
             }
521 521
         }
@@ -545,8 +545,8 @@  discard block
 block discarded – undo
545 545
                     $forwardingRight->$name = $data['number'];
546 546
                     break;
547 547
                 default:
548
-                    if (array_key_exists('fwd_' . $name, $data)) {
549
-                        $forwardingRight->$name = ($data['fwd_' . $name] === -1) ? '' : $data['fwd_' . $name];
548
+                    if (array_key_exists('fwd_'.$name, $data)) {
549
+                        $forwardingRight->$name = ($data['fwd_'.$name] === -1) ? '' : $data['fwd_'.$name];
550 550
                     }
551 551
             }
552 552
         }
@@ -583,15 +583,15 @@  discard block
 block discarded – undo
583 583
                     $externalPhone->$name = $data['user_username'];
584 584
                     break;
585 585
                 case 'disabled':
586
-                    if (array_key_exists('mobile_' . $name, $data)) {
587
-                        $externalPhone->$name = ($data['mobile_' . $name] === 'on') ? '1' : '0';
586
+                    if (array_key_exists('mobile_'.$name, $data)) {
587
+                        $externalPhone->$name = ($data['mobile_'.$name] === 'on') ? '1' : '0';
588 588
                     } else {
589 589
                         $externalPhone->$name = '0';
590 590
                     }
591 591
                     break;
592 592
                 default:
593
-                    if (array_key_exists('mobile_' . $name, $data)) {
594
-                        $externalPhone->$name = $data['mobile_' . $name];
593
+                    if (array_key_exists('mobile_'.$name, $data)) {
594
+                        $externalPhone->$name = $data['mobile_'.$name];
595 595
                     }
596 596
             }
597 597
         }
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 
621 621
         $errors = null;
622 622
         if ($extension !== null && $extension->ExtensionForwardingRights
623
-            && ! $extension->ExtensionForwardingRights->delete()) {
623
+            && !$extension->ExtensionForwardingRights->delete()) {
624 624
             $errors = $extension->ExtensionForwardingRights->getMessages();
625 625
         }
626 626
 
627
-        if ( ! $errors && $extension) {
627
+        if (!$errors && $extension) {
628 628
             $user = $extension->Users;
629
-            if ( ! $user->delete()) {
629
+            if (!$user->delete()) {
630 630
                 $errors = $user->getMessages();
631 631
             }
632 632
         }
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
      */
747 747
     public function GetPhonesRepresentAction(): void
748 748
     {
749
-        if ( ! $this->request->isPost()) {
749
+        if (!$this->request->isPost()) {
750 750
             return;
751 751
         }
752 752
         $numbers = $this->request->getPost('numbers');
Please login to merge, or discard this patch.
src/Core/Asterisk/Configs/ModulesConf.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     protected function generateConfigProtected(): void
19 19
     {
20
-        $conf = "[modules]\n" .
20
+        $conf = "[modules]\n".
21 21
             "autoload=no\n";
22 22
 
23 23
         $modules = [
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             $conf .= $appClass->generateModulesConf();
179 179
         }
180 180
 
181
-        Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/modules.conf', $conf);
182
-        Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/codecs.conf', '');
181
+        Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/modules.conf', $conf);
182
+        Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/codecs.conf', '');
183 183
     }
184 184
 }
185 185
\ No newline at end of file
Please login to merge, or discard this patch.