Passed
Pull Request — master (#20)
by Nikolay
04:51
created
src/PBXCoreREST/Controllers/Sysinfo/GetController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,10 +53,10 @@
 block discarded – undo
53 53
         if ($response !== false) {
54 54
             $response = json_decode($response, true);
55 55
             $filename = $response['data']['filename'] ?? '';
56
-            if ( ! file_exists($filename)) {
56
+            if (!file_exists($filename)) {
57 57
                 $response['messages'][] = 'System information collected file not found';
58 58
             } else {
59
-                $response['data']['content']  = '' . file_get_contents($filename);
59
+                $response['data']['content'] = ''.file_get_contents($filename);
60 60
                 unlink($filename);
61 61
             }
62 62
             $this->response->setPayloadSuccess($response);
Please login to merge, or discard this patch.
src/Common/Models/PbxSettings.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         return [
58 58
             'Name'                            => 'PBX system',
59
-            'VirtualHardwareType'             => 'REAL',//VMWARE,HYPERV,AWS,AZURE
59
+            'VirtualHardwareType'             => 'REAL', //VMWARE,HYPERV,AWS,AZURE
60 60
             'Description'                     => '',
61 61
             'RestartEveryNight'               => '0',
62 62
             'SIPPort'                         => '5060',
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             'VoicemailNotificationsEmail'     => '[email protected]',
101 101
             'VoicemailExten'                  => '*001',
102 102
             'PBXLanguage'                     => 'en-en',
103
-            'PBXInternalExtensionLength'      => '3',// Длина внутреннего номера
103
+            'PBXInternalExtensionLength'      => '3', // Длина внутреннего номера
104 104
             'PBXRecordCalls'                  => '1',
105 105
             'PBXSplitAudioThread'             => '0',
106 106
             'PBXCallParkingExt'               => '800',
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $result = parent::findFirstByKey($key);
139 139
         if ($result === null || $result->value === null) {
140 140
             $arrOfDefaultValues = self::getDefaultArrayValues();
141
-            if ( ! array_key_exists($key, $arrOfDefaultValues)) {
141
+            if (!array_key_exists($key, $arrOfDefaultValues)) {
142 142
                 return '';
143 143
             }
144 144
 
Please login to merge, or discard this patch.
src/Core/Asterisk/Configs/IVRConf.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
         /** @var Sip $sip_peer */
28 28
         foreach ($db_data as $sip_peer) {
29 29
             $len = strlen($sip_peer['extension']);
30
-            if(!in_array($len, $arr_lens)){
30
+            if (!in_array($len, $arr_lens)) {
31 31
                 $arr_lens[] = $len;
32 32
             }
33 33
         }
34 34
 
35
-        $db_data           = IvrMenu::find()->toArray();
35
+        $db_data = IvrMenu::find()->toArray();
36 36
         // Генерация внутреннего номерного плана.
37 37
         $conf = '';
38 38
         foreach ($db_data as $ivr) {
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
             }
49 49
             $try_count_ivr = $ivr['number_of_repeat'];
50 50
             $conf          .= "[ivr-{$ivr['extension']}] \n";
51
-            $conf          .= 'exten => s,1,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))' . "\n\t";
51
+            $conf          .= 'exten => s,1,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))'."\n\t";
52 52
             $conf          .= "same => n,Set(APPEXTEN={$ivr['extension']})\n\t";
53
-            $conf          .= 'same => n,Gosub(dial_app,${EXTEN},1)' . "\n\t";
54
-            $conf          .= 'same => n,Answer()' . "\n\t";
55
-            $conf          .= 'same => n,Set(try_count=0); №6' . "\n\t";
56
-            $conf          .= 'same => n,Set(try_count=$[${try_count} + 1])' . "\n\t";
57
-            $conf          .= 'same => n,GotoIf($[${try_count} > ' . $try_count_ivr . ']?internal,' . $ivr['timeout_extension'] . ',1)' . "\n\t";
53
+            $conf          .= 'same => n,Gosub(dial_app,${EXTEN},1)'."\n\t";
54
+            $conf          .= 'same => n,Answer()'."\n\t";
55
+            $conf          .= 'same => n,Set(try_count=0); №6'."\n\t";
56
+            $conf          .= 'same => n,Set(try_count=$[${try_count} + 1])'."\n\t";
57
+            $conf          .= 'same => n,GotoIf($[${try_count} > '.$try_count_ivr.']?internal,'.$ivr['timeout_extension'].',1)'."\n\t";
58 58
             $conf          .= "same => n,Set(TIMEOUT(digit)=2) \n\t";
59 59
             $conf          .= "same => n,Background({$audio_message}) \n\t";
60 60
             if ($timeout_wait_exten > 0) {
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
             $conf .= "exten => t,1,Goto(s,6)\n";
72 72
 
73 73
             if ($ivr['allow_enter_any_internal_extension'] === '1') {
74
-                foreach ($arr_lens as $len){
74
+                foreach ($arr_lens as $len) {
75 75
                     $extension = Util::getExtensionX($len);
76
-                    $conf .= 'exten => _'.$extension.',1,ExecIf($["${DIALPLAN_EXISTS(internal,${EXTEN},1)}" == "0"]?Goto(i,1))' . "\n\t";
77
-                    $conf .= 'same => n,ExecIf($["${PJSIP_ENDPOINT(${EXTEN},auth)}x" == "x"]?Goto(i,1))' . "\n\t";
78
-                    $conf .= 'same => n,Goto(internal,${EXTEN},1)' . "\n";
76
+                    $conf .= 'exten => _'.$extension.',1,ExecIf($["${DIALPLAN_EXISTS(internal,${EXTEN},1)}" == "0"]?Goto(i,1))'."\n\t";
77
+                    $conf .= 'same => n,ExecIf($["${PJSIP_ENDPOINT(${EXTEN},auth)}x" == "x"]?Goto(i,1))'."\n\t";
78
+                    $conf .= 'same => n,Goto(internal,${EXTEN},1)'."\n";
79 79
                 }
80 80
             }
81 81
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public function extensionGenHints(): string
92 92
     {
93 93
         $conf = '';
94
-        $db_data           = IvrMenu::find()->toArray();
94
+        $db_data = IvrMenu::find()->toArray();
95 95
         foreach ($db_data as $ivr) {
96 96
             $conf .= "exten => {$ivr['extension']},hint,Custom:{$ivr['extension']} \n";
97 97
         }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             $time_str = implode($out);
118 118
             preg_match_all('/^\d{2}:\d{2}:\d{2}.?\d{0,2}$/', $time_str, $matches, PREG_SET_ORDER, 0);
119 119
             if (count($matches) > 0) {
120
-                $data   = date_parse($time_str);
120
+                $data = date_parse($time_str);
121 121
                 $result += $data['minute'] * 60 + $data['second'];
122 122
             }
123 123
         }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $ivr_ext_conf = '';
136 136
         $db_data           = IvrMenu::find()->toArray();
137 137
         foreach ($db_data as $ivr) {
138
-            $ivr_ext_conf .= "exten => {$ivr['extension']},1,Goto(ivr-{$ivr['extension']},s,1)" . "\n";
138
+            $ivr_ext_conf .= "exten => {$ivr['extension']},1,Goto(ivr-{$ivr['extension']},s,1)"."\n";
139 139
         }
140 140
         $ivr_ext_conf .= "\n";
141 141
 
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
     public function extensionGenInternalTransfer(): string
149 149
     {
150 150
         $conf = '';
151
-        $db_data           = IvrMenu::find()->toArray();
151
+        $db_data = IvrMenu::find()->toArray();
152 152
         foreach ($db_data as $ivr) {
153
-            $conf .= 'exten => _' . $ivr['extension'] . ',1,Set(__ISTRANSFER=transfer_)' . " \n\t";
154
-            $conf .= 'same => n,Goto(internal,${EXTEN},1)' . " \n";
153
+            $conf .= 'exten => _'.$ivr['extension'].',1,Set(__ISTRANSFER=transfer_)'." \n\t";
154
+            $conf .= 'same => n,Goto(internal,${EXTEN},1)'." \n";
155 155
         }
156 156
 
157 157
         return $conf;
Please login to merge, or discard this patch.
src/Core/System/SystemLoader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     public function startSystem(): bool
28 28
     {
29 29
         $this->di->getShared('registry')->booting = true;
30
-        $storage                          = new Storage();
30
+        $storage = new Storage();
31 31
         Util::echoWithSyslog(' - Mount storage disk... ');
32 32
         $storage->saveFstab();
33 33
         $storage->configure();
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
         Util::echoGreenDone();
123 123
 
124 124
         Util::echoWithSyslog(' - Configuring Asterisk...'.PHP_EOL);
125
-        $pbx                              = new PBX();
125
+        $pbx = new PBX();
126 126
         $pbx->configure();
127 127
 
128 128
         Util::echoWithSyslog(' - Start Asterisk... ');
129 129
         $pbx->start();
130
-        $system                           = new System();
130
+        $system = new System();
131 131
         $system->onAfterPbxStarted();
132 132
         Util::echoGreenDone();
133 133
 
Please login to merge, or discard this patch.
src/Common/Models/Codecs.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,17 +33,17 @@
 block discarded – undo
33 33
      * Audio or Video codec
34 34
      * @Column(type="string", nullable=true)
35 35
      */
36
-    public ?string $type='audio';
36
+    public ?string $type = 'audio';
37 37
 
38 38
     /**
39 39
      * @Column(type="integer", nullable=true, default="1")
40 40
      */
41
-    public ?string $priority='1';
41
+    public ?string $priority = '1';
42 42
 
43 43
     /**
44 44
      * @Column(type="string", length=1, nullable=true)
45 45
      */
46
-    public ?string $disabled='0';
46
+    public ?string $disabled = '0';
47 47
 
48 48
     /**
49 49
      * @Column(type="string", nullable=true)
Please login to merge, or discard this patch.
sites/pbxcore/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 $di = new FactoryDefault();
18 18
 
19 19
 // Auto-loader configuration
20
-require_once __DIR__ . '/../../src/Common/Config/ClassLoader.php';
20
+require_once __DIR__.'/../../src/Common/Config/ClassLoader.php';
21 21
 
22 22
 // Attach Sentry error logger
23 23
 $errorLogger = new SentryErrorLogger('pbx-core-rest');
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 } catch (Error $e) {
35 35
     $errorLogger->captureException($e);
36 36
     echo $e->getMessage();
37
-    Util::sysLogMsg('pbx_core_api', $e->getMessage() );
37
+    Util::sysLogMsg('pbx_core_api', $e->getMessage());
38 38
 }
39 39
 
40 40
 
Please login to merge, or discard this patch.
sites/admin-cabinet/index.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@
 block discarded – undo
44 44
 
45 45
 try {
46 46
     $application = new Application($di);
47
-	echo $application->handle($_SERVER['REQUEST_URI'])->getContent();
47
+    echo $application->handle($_SERVER['REQUEST_URI'])->getContent();
48 48
 } catch (Error $e) {
49
-	$errorLogger->captureException($e);
50
-	PhpError::exceptionHandler($e);
51
-	echo $e->getMessage();
49
+    $errorLogger->captureException($e);
50
+    PhpError::exceptionHandler($e);
51
+    echo $e->getMessage();
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 /**
22 22
  * Auto-loader configuration
23 23
  */
24
-require_once __DIR__ . '/../../src/Common/Config/ClassLoader.php';
24
+require_once __DIR__.'/../../src/Common/Config/ClassLoader.php';
25 25
 
26 26
 /**
27 27
  * Load application services
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 // register_shutdown_function([PhpError::class,'runtimeShutdown']);
37 37
 // set_error_handler([PhpError::class,'errorHandler']);
38 38
 
39
-if (class_exists(PrettyPageHandler::class)){
39
+if (class_exists(PrettyPageHandler::class)) {
40 40
     $whoops = new Run();
41 41
     $whoops->pushHandler(new PrettyPageHandler());
42 42
     $whoops->register();
Please login to merge, or discard this patch.
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.