Passed
Push — develop ( a2fddf...dc6451 )
by Nikolay
04:41
created
src/AdminCabinet/Controllers/SystemDiagnosticController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
     public function indexAction(): void
16 16
     {
17
-        $this->view->form     = new SystemDiagnosticForm();
17
+        $this->view->form = new SystemDiagnosticForm();
18 18
     }
19 19
 
20 20
 
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 (Throwable $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.
src/Common/Models/PbxSettings.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @Primary
26 26
      * @Column(type="string", nullable=false)
27 27
      */
28
-    public string $key='';
28
+    public string $key = '';
29 29
 
30 30
     /**
31 31
      * @Column(type="string", nullable=true)
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         return [
44 44
             'Name'                            => 'PBX system',
45
-            'VirtualHardwareType'             => 'REAL',//VMWARE,HYPERV,AWS,AZURE
45
+            'VirtualHardwareType'             => 'REAL', //VMWARE,HYPERV,AWS,AZURE
46 46
             'Description'                     => '',
47 47
             'RestartEveryNight'               => '0',
48 48
             'SIPPort'                         => '5060',
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             'VoicemailNotificationsEmail'     => '[email protected]',
89 89
             'VoicemailExten'                  => '*001',
90 90
             'PBXLanguage'                     => 'en-en',
91
-            'PBXInternalExtensionLength'      => '3',// Длина внутреннего номера
91
+            'PBXInternalExtensionLength'      => '3', // Длина внутреннего номера
92 92
             'PBXRecordCalls'                  => '1',
93 93
             'PBXSplitAudioThread'             => '0',
94 94
             'PBXCallParkingExt'               => '800',
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public static function getValueByKey(string $key): string
140 140
     {
141
-        $cacheKey   = explode('\\', static::class)[3];
142
-        $parameters= [
141
+        $cacheKey = explode('\\', static::class)[3];
142
+        $parameters = [
143 143
             'cache' => [
144 144
                 'key'=>$cacheKey.'-getValueByKey',
145 145
                 'lifetime' => 300,
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
         ];
148 148
         $currentSettings = parent::find($parameters);
149 149
 
150
-        foreach ($currentSettings as $record){
151
-            if ($record->key===$key
150
+        foreach ($currentSettings as $record) {
151
+            if ($record->key === $key
152 152
                 && isset($record->value)
153
-            ){
153
+            ) {
154 154
                 return $record->value;
155 155
             }
156 156
         }
Please login to merge, or discard this patch.
src/Core/Workers/WorkerCallEvents.php 2 patches
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function MixMonitor($channel, $file_name = null, $sub_dir = null, $full_name = null): string
39 39
     {
40
-        $resFile = $this->mixMonitorChannels[$channel]??'';
41
-        if($resFile !== ''){
40
+        $resFile = $this->mixMonitorChannels[$channel] ?? '';
41
+        if ($resFile !== '') {
42 42
             return $resFile;
43 43
         }
44 44
         $resFile           = '';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         if ($this->record_calls) {
47 47
             [$f, $options] = $this->setMonitorFilenameOptions($full_name, $sub_dir, $file_name);
48 48
             $arr = $this->am->GetChannels(false);
49
-            if(!in_array($channel, $arr, true)){
49
+            if (!in_array($channel, $arr, true)) {
50 50
                 return '';
51 51
             }
52 52
             $srcFile = "{$f}.wav";
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function StopMixMonitor($channel): void
90 90
     {
91
-        if(isset($this->mixMonitorChannels[$channel])){
91
+        if (isset($this->mixMonitorChannels[$channel])) {
92 92
             unset($this->mixMonitorChannels[$channel]);
93
-        }else{
93
+        } else {
94 94
             return;
95 95
         }
96 96
         if ($this->record_calls) {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         foreach ($m_data as $row) {
129 129
             $row->writeAttribute('endtime', $data['start']);
130 130
             $res = $row->update();
131
-            if ( ! $res) {
131
+            if (!$res) {
132 132
                 Util::sysLogMsg('Action_app_end', implode(' ', $row->getMessages()));
133 133
             }
134 134
         }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             // мобильный и внутренний номер.
148 148
             $filter = [
149 149
                 '(UNIQUEID=:UNIQUEID: OR UNIQUEID=:org_id:) AND endtime = ""',
150
-                'bind' => ['UNIQUEID' => $data['UNIQUEID'], 'org_id' => $data['org_id'],],
150
+                'bind' => ['UNIQUEID' => $data['UNIQUEID'], 'org_id' => $data['org_id'], ],
151 151
             ];
152 152
         } else {
153 153
             $filter = [
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
         /** @var CallDetailRecordsTmp $row */
164 164
         $m_data = CallDetailRecordsTmp::find($filter);
165 165
         foreach ($m_data as $row) {
166
-            if ( ! is_object($row)) {
166
+            if (!is_object($row)) {
167 167
                 continue;
168 168
             }
169 169
             ///
170 170
             // Проверим, если более одного канала SIP/256 при входящем.
171 171
             $column_chan_name = ('ORIGINATE' === $row->dialstatus) ? 'src_chan' : 'dst_chan';
172 172
 
173
-            if ( ! empty($row->$column_chan_name) && $data['dst_chan'] !== $row->$column_chan_name) {
173
+            if (!empty($row->$column_chan_name) && $data['dst_chan'] !== $row->$column_chan_name) {
174 174
                 if ($row_create) {
175 175
                     continue;
176 176
                 }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                     $new_row->writeAttribute($attribute, $value);
185 185
                 }
186 186
                 $new_row->writeAttribute($column_chan_name, $data['dst_chan']);
187
-                $new_row->writeAttribute('UNIQUEID', $data['UNIQUEID'] . '_' . $data['dst_chan']);
187
+                $new_row->writeAttribute('UNIQUEID', $data['UNIQUEID'].'_'.$data['dst_chan']);
188 188
                 // Подмена $row;
189 189
                 $row        = $new_row;
190 190
                 $row_create = true;
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
                 $row->writeAttribute('dst_chan', $data['dst_chan']);
201 201
             }
202 202
 
203
-            if (isset($data['to_account']) && ! empty($data['to_account'])) {
203
+            if (isset($data['to_account']) && !empty($data['to_account'])) {
204 204
                 $row->writeAttribute($account_col, $data['to_account']);
205 205
             }
206
-            if (isset($data['dst_call_id']) && ! empty($data['dst_call_id'])) {
206
+            if (isset($data['dst_call_id']) && !empty($data['dst_call_id'])) {
207 207
                 $row->writeAttribute('dst_call_id', $data['dst_call_id']);
208 208
             }
209 209
             $res = $row->save();
210
-            if ( ! $res) {
210
+            if (!$res) {
211 211
                 Util::sysLogMsg('Action_dial_create_chan', implode(' ', $row->getMessages()));
212 212
             }
213 213
         }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             // Событие возникает, когда мы пытаемся перехватить вызов на соседний телефон.
228 228
             $filter = [
229 229
                 'UNIQUEID=:UNIQUEID:',
230
-                'bind' => ['UNIQUEID' => $data['old_id'],],
230
+                'bind' => ['UNIQUEID' => $data['old_id'], ],
231 231
             ];
232 232
             /** @var CallDetailRecordsTmp $m_data */
233 233
             $m_data = CallDetailRecordsTmp::find($filter);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
                 $new_data['dst_chan']       = $data['agi_channel'];
242 242
                 $new_data['dst_num']        = $data['dst_num'];
243 243
                 $new_data['UNIQUEID']       = $data['id'];
244
-                $new_data['recordingfile']  = $this->MixMonitor($new_data['dst_chan'],  'pickup_'.$new_data['UNIQUEID']);
244
+                $new_data['recordingfile']  = $this->MixMonitor($new_data['dst_chan'], 'pickup_'.$new_data['UNIQUEID']);
245 245
 
246 246
                 unset($new_data['id'], $new_data['end']);
247 247
                 self::insertDataToDbM($new_data);
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                 $this->am->UserEvent('CdrConnector', ['AgiData' => $AgiData]);
254 254
             }
255 255
         } else {
256
-            if ( ! empty($data['ENDCALLONANSWER'])) {
256
+            if (!empty($data['ENDCALLONANSWER'])) {
257 257
                 // Переменная ENDCALLONANSWER устанавливается при начале работы умной маршуртизации.
258 258
                 // Как только произошел ответ на вызов, отметим вызов на приложение как завершенный.
259 259
                 $filter = [
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                     $row->writeAttribute('endtime', $data['answer']);
271 271
                     $row->writeAttribute('is_app', 1);
272 272
                     $res = $row->save();
273
-                    if ( ! $res) {
273
+                    if (!$res) {
274 274
                         Util::sysLogMsg('ENDCALLONANSWER', implode(' ', $row->getMessages()));
275 275
                     }
276 276
                 }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                     '(UNIQUEID=:UNIQUEID: OR UNIQUEID=:UNIQUEID_CHAN:) AND answer = "" AND endtime = ""',
293 293
                     'bind' => [
294 294
                         'UNIQUEID'      => $data['id'],
295
-                        'UNIQUEID_CHAN' => $data['id'] . '_' . $data['agi_channel'],
295
+                        'UNIQUEID_CHAN' => $data['id'].'_'.$data['agi_channel'],
296 296
                     ],
297 297
                 ];
298 298
             }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                         continue;
306 306
                     }
307 307
                     // Найдем все прочие CDR по данному originate и отметим как завершенные.
308
-                    $filter      = [
308
+                    $filter = [
309 309
                         'linkedid=:linkedid: AND endtime <> "" AND src_chan <> :src_chan:',
310 310
                         'bind' => [
311 311
                             'linkedid' => $row->linkedid,
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                             $orgn_row->writeAttribute('endtime', $data['answer']);
320 320
                         }
321 321
                         $orgn_row->writeAttribute('dst_chan', '');
322
-                        $orgn_row->writeAttribute('UNIQUEID', $data['id'] . '_' . $orgn_row->src_chan);
322
+                        $orgn_row->writeAttribute('UNIQUEID', $data['id'].'_'.$orgn_row->src_chan);
323 323
                         $orgn_row->update();
324 324
                     }
325 325
 
@@ -331,13 +331,13 @@  discard block
 block discarded – undo
331 331
                 }
332 332
 
333 333
                 $row->writeAttribute('answer', $data['answer']);
334
-                $recFile = $data['recordingfile']??'';
335
-                if(!empty($recFile)){
334
+                $recFile = $data['recordingfile'] ?? '';
335
+                if (!empty($recFile)) {
336 336
                     $this->mixMonitorChannels[$data['agi_channel']] = $recFile;
337 337
                     $row->writeAttribute('recordingfile', $recFile);
338 338
                 }
339 339
                 $res = $row->save();
340
-                if ( !$res) {
340
+                if (!$res) {
341 341
                     Util::sysLogMsg('Action_dial_answer', implode(' ', $row->getMessages()));
342 342
                 }
343 343
             }
@@ -363,10 +363,10 @@  discard block
 block discarded – undo
363 363
         $this->hangupChanCheckSipTrtansfer($data, $channels);
364 364
 
365 365
         // Очистим память.
366
-        if(isset($this->checkChanHangupTransfer[$data['agi_channel']])){
366
+        if (isset($this->checkChanHangupTransfer[$data['agi_channel']])) {
367 367
             unset($this->checkChanHangupTransfer[$data['agi_channel']]);
368 368
         }
369
-        if(isset($this->mixMonitorChannels[$data['agi_channel']])){
369
+        if (isset($this->mixMonitorChannels[$data['agi_channel']])) {
370 370
             unset($this->mixMonitorChannels[$data['agi_channel']]);
371 371
         }
372 372
     }
@@ -378,24 +378,24 @@  discard block
 block discarded – undo
378 378
      */
379 379
     private function hangupChanCheckSipTrtansfer($data, $channels):void{
380 380
         $not_local = (stripos($data['agi_channel'], 'local/') === false);
381
-        if($not_local === false || $data['OLD_LINKEDID'] !== $data['linkedid']) {
381
+        if ($not_local === false || $data['OLD_LINKEDID'] !== $data['linkedid']) {
382 382
             return;
383 383
         }
384 384
         $active_chans = $this->am->GetChannels(false);
385 385
         // Намек на SIP трансфер.
386 386
         foreach ($channels as $data_chan) {
387
-            if ( ! in_array($data_chan['chan'], $active_chans, true)) {
387
+            if (!in_array($data_chan['chan'], $active_chans, true)) {
388 388
                 // Вызов уже завершен. Не интересно.
389 389
                 continue;
390 390
             }
391 391
             $BRIDGEPEER = $this->am->GetVar($data_chan['chan'], 'BRIDGEPEER', null, false);
392
-            if ( ! in_array($BRIDGEPEER, $active_chans, true) || !is_string($BRIDGEPEER)) {
392
+            if (!in_array($BRIDGEPEER, $active_chans, true) || !is_string($BRIDGEPEER)) {
393 393
                 // Вызов уже завершен. Не интересно.
394 394
                 continue;
395 395
             }
396 396
 
397 397
             $linkedid = $this->am->GetVar($data_chan['chan'], 'CDR(linkedid)', null, false);
398
-            if ( empty($linkedid) || $linkedid === $data['linkedid']) {
398
+            if (empty($linkedid) || $linkedid === $data['linkedid']) {
399 399
                 continue;
400 400
             }
401 401
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
             $n_data['start']         = date('Y-m-d H:i:s');
409 409
             $n_data['answer']        = date('Y-m-d H:i:s');
410 410
             $n_data['linkedid']      = $linkedid;
411
-            $n_data['UNIQUEID']      = $data['linkedid'] . Util::generateRandomString();
411
+            $n_data['UNIQUEID']      = $data['linkedid'].Util::generateRandomString();
412 412
             $n_data['transfer']      = '0';
413 413
             $n_data['recordingfile'] = $this->MixMonitor($n_data['dst_chan'], $n_data['UNIQUEID']);
414 414
             $n_data['did']           = $data_chan['did'];
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
      * @param array $channels
441 441
      */
442 442
     private function hangupChanEndCalls(array $data, array &$transfer_calls, array &$channels):void{
443
-        $filter         = [
443
+        $filter = [
444 444
             'linkedid=:linkedid: AND endtime = "" AND (src_chan=:src_chan: OR dst_chan=:dst_chan:)',
445 445
             'bind' => [
446 446
                 'linkedid' => $data['linkedid'],
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
             }
458 458
             if ($row->dialstatus === 'ORIGINATE') {
459 459
                 $row->writeAttribute('dialstatus', '');
460
-                if($row->answer === ''){
461
-                    $newId = $row->linkedid.'_'.$row->src_num.'_'.substr($row->src_chan, strpos($row->src_chan,'-') +1);
460
+                if ($row->answer === '') {
461
+                    $newId = $row->linkedid.'_'.$row->src_num.'_'.substr($row->src_chan, strpos($row->src_chan, '-') + 1);
462 462
                     $row->writeAttribute('UNIQUEID', $newId);
463 463
                 }
464 464
             }
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
                 $row->writeAttribute('dialstatus', $data['dialstatus']);
472 472
             }
473 473
             $res = $row->update();
474
-            if ( ! $res) {
474
+            if (!$res) {
475 475
                 Util::sysLogMsg('Action_hangup_chan', implode(' ', $row->getMessages()));
476 476
             }
477 477
 
@@ -503,14 +503,14 @@  discard block
 block discarded – undo
503 503
      */
504 504
     public function Action_CreateRowTransfer($action, $data, $calls_data = null): void
505 505
     {
506
-        if( isset($this->checkChanHangupTransfer[$data['agi_channel']]) ) {
506
+        if (isset($this->checkChanHangupTransfer[$data['agi_channel']])) {
507 507
             return;
508 508
         }
509 509
 
510 510
         $this->checkChanHangupTransfer[$data['agi_channel']] = $action;
511 511
 
512 512
         if (null === $calls_data) {
513
-            $filter     = [
513
+            $filter = [
514 514
                 'linkedid=:linkedid: AND endtime = "" AND transfer=1 AND (src_chan=:chan: OR dst_chan=:chan:)',
515 515
                 'bind'  => [
516 516
                     'linkedid' => $data['linkedid'],
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
                     $insert_data[$fname_chan] = $row_data['dst_chan'];
533 533
                     $insert_data[$fname_num]  = $row_data['dst_num'];
534 534
                 } else {
535
-                    $fname_chan = ! isset($insert_data['src_chan']) ? 'src_chan' : 'dst_chan';
536
-                    $fname_num  = ! isset($insert_data['src_num']) ? 'src_num' : 'dst_num';
535
+                    $fname_chan = !isset($insert_data['src_chan']) ? 'src_chan' : 'dst_chan';
536
+                    $fname_num  = !isset($insert_data['src_num']) ? 'src_num' : 'dst_num';
537 537
 
538 538
                     $insert_data[$fname_chan] = $row_data['src_chan'];
539 539
                     $insert_data[$fname_num]  = $row_data['src_num'];
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
             $this->StopMixMonitor($insert_data['dst_chan']);
545 545
             $recordingfile = $this->MixMonitor(
546 546
                 $insert_data['dst_chan'],
547
-                'transfer_' . $insert_data['src_num'] . '_' . $insert_data['dst_num'] . '_' . $data['linkedid']
547
+                'transfer_'.$insert_data['src_num'].'_'.$insert_data['dst_num'].'_'.$data['linkedid']
548 548
             );
549 549
             //
550 550
             $insert_data['action']        = "{$action}_end_trasfer";
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
             $this->am->UserEvent('CdrConnector', ['AgiData' => $AgiData]);
566 566
 
567 567
             self::insertDataToDbM($insert_data);
568
-        } elseif (empty($calls_data[0]['answer']) && count($calls_data) === 1 && ! empty($calls_data[0]['recordingfile'])) {
568
+        } elseif (empty($calls_data[0]['answer']) && count($calls_data) === 1 && !empty($calls_data[0]['recordingfile'])) {
569 569
             // Возобновление записи разговора при срыве переадресации.
570 570
             $row_data = $calls_data[0];
571 571
             $chan     = ($data['agi_channel'] === $row_data['src_chan']) ? $row_data['dst_chan'] : $row_data['src_chan'];
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
             /** @var CallDetailRecordsTmp $row */
582 582
             $not_ended_cdr = null;
583 583
             $transferNotComplete = false;
584
-            foreach ($cdr as $row){
585
-                if($row->transfer === '1' && ($row->src_chan === $chan || $row->dst_chan === $chan) ){
584
+            foreach ($cdr as $row) {
585
+                if ($row->transfer === '1' && ($row->src_chan === $chan || $row->dst_chan === $chan)) {
586 586
                     $not_ended_cdr = $row;
587 587
                 }
588
-                if($row->answer === '' && $row->endtime === ''
589
-                    && ($row->src_chan === $chan || $row->dst_chan === $chan) ){
588
+                if ($row->answer === '' && $row->endtime === ''
589
+                    && ($row->src_chan === $chan || $row->dst_chan === $chan)) {
590 590
                     $transferNotComplete = true;
591 591
                 }
592 592
             }
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
      */
645 645
     public function Action_transfer_dial_create_chan($data): void
646 646
     {
647
-        $filter     = [
647
+        $filter = [
648 648
             'UNIQUEID=:UNIQUEID: AND endtime = "" AND answer = ""',
649 649
             'bind' => [
650 650
                 'UNIQUEID' => $data['transfer_UNIQUEID'],
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
         foreach ($m_data as $row) {
658 658
             ///
659 659
             // Проверим, если более одного канала SIP/256 при входящем.
660
-            if ( ! empty($row->dst_chan) && $data['dst_chan'] !== $row->dst_chan) {
660
+            if (!empty($row->dst_chan) && $data['dst_chan'] !== $row->dst_chan) {
661 661
                 if ($row_create) {
662 662
                     continue;
663 663
                 }
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
                     $new_row->writeAttribute($attribute, $value);
672 672
                 }
673 673
                 $new_row->writeAttribute('dst_chan', $data['dst_chan']);
674
-                $new_row->writeAttribute('UNIQUEID', $data['transfer_UNIQUEID'] . '_' . $data['dst_chan']);
674
+                $new_row->writeAttribute('UNIQUEID', $data['transfer_UNIQUEID'].'_'.$data['dst_chan']);
675 675
                 // $new_row->save();
676 676
                 // Подмена $row;
677 677
                 $row        = $new_row;
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
 
684 684
             $row->writeAttribute('dst_chan', $data['dst_chan']);
685 685
             $row->writeAttribute('recordingfile', $data['recordingfile']);
686
-            if (isset($data['dst_call_id']) && ! empty($data['dst_call_id'])) {
686
+            if (isset($data['dst_call_id']) && !empty($data['dst_call_id'])) {
687 687
                 $row->writeAttribute('dst_call_id', $data['dst_call_id']);
688 688
             }
689 689
             $res = $row->save();
690
-            if ( ! $res) {
690
+            if (!$res) {
691 691
                 Util::sysLogMsg('Action_transfer_dial_create_chan', implode(' ', $row->getMessages()));
692 692
             }
693 693
         }
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
             '(UNIQUEID=:UNIQUEID: OR UNIQUEID=:UNIQUEID_CHAN:) AND answer = "" AND endtime = ""',
705 705
             'bind' => [
706 706
                 'UNIQUEID'      => $data['transfer_UNIQUEID'],
707
-                'UNIQUEID_CHAN' => $data['transfer_UNIQUEID'] . '_' . $data['agi_channel'],
707
+                'UNIQUEID_CHAN' => $data['transfer_UNIQUEID'].'_'.$data['agi_channel'],
708 708
             ],
709 709
         ];
710 710
 
@@ -713,13 +713,13 @@  discard block
 block discarded – undo
713 713
         $m_data = CallDetailRecordsTmp::find($filter);
714 714
         foreach ($m_data as $row) {
715 715
             $row->writeAttribute('answer', $data['answer']);
716
-            $recFile = $data['recordingfile']??'';
717
-            if(!empty($recFile)){
716
+            $recFile = $data['recordingfile'] ?? '';
717
+            if (!empty($recFile)) {
718 718
                 $this->mixMonitorChannels[$data['agi_channel']] = $recFile;
719 719
                 $row->writeAttribute('recordingfile', $recFile);
720 720
             }
721 721
             $res = $row->save();
722
-            if ( !$res) {
722
+            if (!$res) {
723 723
                 Util::sysLogMsg('Action_transfer_dial_answer', implode(' ', $row->getMessages()));
724 724
             }
725 725
         }
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
                 // Завершим вызов в CDR.
754 754
                 $row->writeAttribute('endtime', $data['end']);
755 755
                 $row->writeAttribute('transfer', 0);
756
-                if ( ! $row->save()) {
756
+                if (!$row->save()) {
757 757
                     Util::sysLogMsg('Action_transfer_dial_answer', implode(' ', $row->getMessages()));
758 758
                 }
759 759
             }
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
                 // Ответа не было. Переадресация отменена.
789 789
                 $row->writeAttribute('endtime', $data['end']);
790 790
                 $row->writeAttribute('transfer', 0);
791
-                if ( ! $row->save()) {
791
+                if (!$row->save()) {
792 792
                     Util::sysLogMsg('Action_transfer_dial_answer', implode(' ', $row->getMessages()));
793 793
                 }
794 794
             }
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
                 $this->MixMonitor($row->src_chan, $info['filename'], $subdir);
809 809
                 // Снимем со строк признак переадресации.
810 810
                 $row->writeAttribute('transfer', 0);
811
-                if ( ! $row->save()) {
811
+                if (!$row->save()) {
812 812
                     Util::sysLogMsg('Action_transfer_dial_answer', implode(' ', $row->getMessages()));
813 813
                 }
814 814
             }
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 
885 885
                 $f_list = $m_data->toArray();
886 886
                 foreach ($data as $attribute => $value) {
887
-                    if ( ! array_key_exists($attribute, $f_list)) {
887
+                    if (!array_key_exists($attribute, $f_list)) {
888 888
                         continue;
889 889
                     }
890 890
                     $m_data->writeAttribute($attribute, $value);
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
             $row->writeAttribute('answer', $data['answer']);
956 956
             $row->writeAttribute('endtime', $data['answer']);
957 957
             $res = $row->save();
958
-            if ( ! $res) {
958
+            if (!$res) {
959 959
                 Util::sysLogMsg('Action_queue_answer', implode(' ', $row->getMessages()));
960 960
             }
961 961
         }
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
                 $row->writeAttribute('dialstatus', $data['dialstatus']);
985 985
             }
986 986
             $res = $row->save();
987
-            if ( ! $res) {
987
+            if (!$res) {
988 988
                 Util::sysLogMsg('Action_queue_end', implode(' ', $row->getMessages()));
989 989
             }
990 990
         }
@@ -1014,11 +1014,11 @@  discard block
 block discarded – undo
1014 1014
             if ($dest_chan === $row->dst_chan) {
1015 1015
                 $is_local        = (stripos($data['src_chan'], 'local/') !== false);
1016 1016
                 $is_stored_local = (stripos($row->src_chan, 'local/') !== false);
1017
-                if ($row->UNIQUEID === $data['UNIQUEID'] && $is_local && ! $is_stored_local) {
1017
+                if ($row->UNIQUEID === $data['UNIQUEID'] && $is_local && !$is_stored_local) {
1018 1018
                     $data['src_chan'] = $row->src_chan;
1019 1019
                 }
1020 1020
                 if (file_exists($row->recordingfile) || file_exists(
1021
-                        Util::trimExtensionForFile($row->recordingfile) . '.wav'
1021
+                        Util::trimExtensionForFile($row->recordingfile).'.wav'
1022 1022
                     )) {
1023 1023
                     // Переопределим путь к файлу записи разговора. Для конферецнии файл один.
1024 1024
                     $recordingfile = $row->recordingfile;
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
             // Подменим ID на идентификатор конференции.
1031 1031
             $row->writeAttribute('linkedid', $data['meetme_id']);
1032 1032
             $res = $row->save();
1033
-            if ( ! $res) {
1033
+            if (!$res) {
1034 1034
                 Util::sysLogMsg('Action_hangup_chan_meetme', implode(' ', $row->getMessages()));
1035 1035
             }
1036 1036
         }
@@ -1047,11 +1047,11 @@  discard block
 block discarded – undo
1047 1047
             $row->writeAttribute('transfer', 0);
1048 1048
             $row->writeAttribute('linkedid', $data['meetme_id']);
1049 1049
 
1050
-            if ( ! empty($recordingfile)) {
1050
+            if (!empty($recordingfile)) {
1051 1051
                 $row->writeAttribute('recordingfile', $recordingfile);
1052 1052
             }
1053 1053
             $res = $row->save();
1054
-            if ( ! $res) {
1054
+            if (!$res) {
1055 1055
                 Util::sysLogMsg('Action_hangup_chan_meetme', implode(' ', $row->getMessages()));
1056 1056
             }
1057 1057
         }
@@ -1090,9 +1090,9 @@  discard block
 block discarded – undo
1090 1090
      */
1091 1091
     public function callEventsWorker($tube): void
1092 1092
     {
1093
-        $data      = json_decode($tube->getBody(), true);
1094
-        $funcName = "Action_".$data['action']??'';
1095
-        if ( method_exists($this, $funcName) ) {
1093
+        $data = json_decode($tube->getBody(), true);
1094
+        $funcName = "Action_".$data['action'] ?? '';
1095
+        if (method_exists($this, $funcName)) {
1096 1096
             $this->$funcName($data);
1097 1097
         }
1098 1098
         $tube->reply(json_encode(true));
@@ -1122,14 +1122,14 @@  discard block
 block discarded – undo
1122 1122
     public function updateDataInDbM($data): bool
1123 1123
     {
1124 1124
         if (empty($data['UNIQUEID'])) {
1125
-            Util::sysLogMsg(__FUNCTION__, 'UNIQUEID is empty ' . json_encode($data));
1125
+            Util::sysLogMsg(__FUNCTION__, 'UNIQUEID is empty '.json_encode($data));
1126 1126
 
1127 1127
             return false;
1128 1128
         }
1129 1129
 
1130 1130
         $filter = [
1131 1131
             "UNIQUEID=:id:",
1132
-            'bind' => ['id' => $data['UNIQUEID'],],
1132
+            'bind' => ['id' => $data['UNIQUEID'], ],
1133 1133
         ];
1134 1134
         /** @var CallDetailRecordsTmp $m_data */
1135 1135
         $m_data = CallDetailRecordsTmp::findFirst($filter);
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
         }
1139 1139
         $f_list = $m_data->toArray();
1140 1140
         foreach ($data as $attribute => $value) {
1141
-            if ( ! array_key_exists($attribute, $f_list)) {
1141
+            if (!array_key_exists($attribute, $f_list)) {
1142 1142
                 continue;
1143 1143
             }
1144 1144
             if ('UNIQUEID' === $attribute) {
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
             $m_data->writeAttribute($attribute, $value);
1148 1148
         }
1149 1149
         $res = $m_data->save();
1150
-        if ( ! $res) {
1150
+        if (!$res) {
1151 1151
             Util::sysLogMsg(__FUNCTION__, implode(' ', $m_data->getMessages()));
1152 1152
         }
1153 1153
 
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
     public static function insertDataToDbM($data): bool
1187 1187
     {
1188 1188
         if (empty($data['UNIQUEID'])) {
1189
-            Util::sysLogMsg(__FUNCTION__, 'UNIQUEID is empty ' . json_encode($data));
1189
+            Util::sysLogMsg(__FUNCTION__, 'UNIQUEID is empty '.json_encode($data));
1190 1190
 
1191 1191
             return false;
1192 1192
         }
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
         $m_data = CallDetailRecordsTmp::findFirst(
1197 1197
             [
1198 1198
                 "UNIQUEID=:id:",
1199
-                'bind' => ['id' => $data['UNIQUEID'],],
1199
+                'bind' => ['id' => $data['UNIQUEID'], ],
1200 1200
             ]
1201 1201
         );
1202 1202
         if ($m_data === null) {
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
         } elseif (isset($data['IS_ORGNT']) && $data['IS_ORGNT'] !== false && $data['action'] === 'dial') {
1206 1206
             if (empty($m_data->endtime)) {
1207 1207
                 // Если это оригинация dial может прийти дважды.
1208
-                if(!empty($m_data->src_num) && $m_data->src_num === $data['dst_num']){
1208
+                if (!empty($m_data->src_num) && $m_data->src_num === $data['dst_num']) {
1209 1209
                     $m_data->dst_num = $data['src_num'];
1210 1210
                     $m_data->save();
1211 1211
                 }
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
             $new_m_data->transfer     = $data['transfer'];
1231 1231
 
1232 1232
             $res = $new_m_data->save();
1233
-            if ( ! $res) {
1233
+            if (!$res) {
1234 1234
                 Util::sysLogMsg(__FUNCTION__, implode(' ', $m_data->getMessages()));
1235 1235
             }
1236 1236
 
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 
1240 1240
         $f_list = $m_data->toArray();
1241 1241
         foreach ($data as $attribute => $value) {
1242
-            if ( ! array_key_exists($attribute, $f_list)) {
1242
+            if (!array_key_exists($attribute, $f_list)) {
1243 1243
                 continue;
1244 1244
             }
1245 1245
             if ($is_new === false && 'UNIQUEID' === $attribute) {
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
             $m_data->writeAttribute($attribute, $value);
1249 1249
         }
1250 1250
         $res = $m_data->save();
1251
-        if ( ! $res) {
1251
+        if (!$res) {
1252 1252
             Util::sysLogMsg(__FUNCTION__, implode(' ', $m_data->getMessages()));
1253 1253
         }
1254 1254
 
@@ -1263,12 +1263,12 @@  discard block
 block discarded – undo
1263 1263
         $q      = $tube->getBody();
1264 1264
         $filter = json_decode($q, true);
1265 1265
 
1266
-        if($this->filterNotValid($filter)){
1266
+        if ($this->filterNotValid($filter)) {
1267 1267
             $tube->reply('[]');
1268 1268
             return;
1269 1269
         }
1270 1270
 
1271
-        $res    = null;
1271
+        $res = null;
1272 1272
         try {
1273 1273
             if (isset($filter['miko_tmp_db'])) {
1274 1274
                 $res = CallDetailRecordsTmp::find($filter);
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
             }
1288 1288
             $filter['add_pack_query']['bind'][$filter['columns']] = $arr;
1289 1289
 
1290
-            if($this->filterNotValid($filter['add_pack_query'])){
1290
+            if ($this->filterNotValid($filter['add_pack_query'])) {
1291 1291
                 $tube->reply('[]');
1292 1292
                 return;
1293 1293
             }
@@ -1303,7 +1303,7 @@  discard block
 block discarded – undo
1303 1303
         if (isset($filter['miko_result_in_file'])) {
1304 1304
             $di         = Di::getDefault();
1305 1305
             $dirsConfig = $di->getShared('config');
1306
-            $filename   = $dirsConfig->path('core.tempDir') . '/' . md5(microtime(true));
1306
+            $filename   = $dirsConfig->path('core.tempDir').'/'.md5(microtime(true));
1307 1307
             file_put_contents($filename, $res_data);
1308 1308
             Util::addRegularWWWRights($filename);
1309 1309
             $res_data = json_encode($filename);
@@ -1319,16 +1319,16 @@  discard block
 block discarded – undo
1319 1319
      *
1320 1320
      * @return bool
1321 1321
      */
1322
-    private function filterNotValid($filter){
1322
+    private function filterNotValid($filter) {
1323 1323
         $haveErrors = false;
1324
-        if(isset($filter['bind'])){
1325
-            if(is_array($filter)){
1324
+        if (isset($filter['bind'])) {
1325
+            if (is_array($filter)) {
1326 1326
                 foreach ($filter['bind'] as $bindValue) {
1327
-                    if(empty($bindValue)){
1327
+                    if (empty($bindValue)) {
1328 1328
                         $haveErrors = true;
1329 1329
                     }
1330 1330
                 }
1331
-            }else{
1331
+            } else {
1332 1332
                 $haveErrors = true;
1333 1333
             }
1334 1334
         }
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
 
1338 1338
     public function errorHandler($m): void
1339 1339
     {
1340
-        Util::sysLogMsg(self::class . '_ERROR', $m);
1340
+        Util::sysLogMsg(self::class.'_ERROR', $m);
1341 1341
     }
1342 1342
 }
1343 1343
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         if(isset($this->mixMonitorChannels[$channel])){
92 92
             unset($this->mixMonitorChannels[$channel]);
93
-        }else{
93
+        } else{
94 94
             return;
95 95
         }
96 96
         if ($this->record_calls) {
@@ -1319,7 +1319,8 @@  discard block
 block discarded – undo
1319 1319
      *
1320 1320
      * @return bool
1321 1321
      */
1322
-    private function filterNotValid($filter){
1322
+    private function filterNotValid($filter)
1323
+    {
1323 1324
         $haveErrors = false;
1324 1325
         if(isset($filter['bind'])){
1325 1326
             if(is_array($filter)){
@@ -1328,7 +1329,7 @@  discard block
 block discarded – undo
1328 1329
                         $haveErrors = true;
1329 1330
                     }
1330 1331
                 }
1331
-            }else{
1332
+            } else{
1332 1333
                 $haveErrors = true;
1333 1334
             }
1334 1335
         }
Please login to merge, or discard this patch.
src/Core/Asterisk/CdrDb.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
             $date = CallEventsLogs::maximum(
50 50
                 ['linkedid = "'.$row_cdr->linkedid.'"', 'column' => 'eventtime']
51 51
             );
52
-            if ( ! $row_cdr->endtime) {
52
+            if (!$row_cdr->endtime) {
53 53
                 if ($date) {
54 54
                     $row_cdr->endtime = $date;
55 55
                 } elseif ($row_cdr->answer) {
Please login to merge, or discard this patch.
src/Core/Workers/WorkerModelsEvents.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         foreach ($additionalModules as $appClass) {
190 190
             // Проверим, зависит ли объект от измененных данных.
191 191
             $dependences = $appClass->dependenceModels();
192
-            if (in_array($called_class, $dependences, true)){
192
+            if (in_array($called_class, $dependences, true)) {
193 193
                 // Получаем новые настройки.
194 194
                 $appClass->getSettings();
195 195
             }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                 break;
236 236
             case Codecs::class:
237 237
                 $this->modified_tables[self::R_IAX] = true;
238
-                $this->modified_tables[self::R_SIP]     = true;
238
+                $this->modified_tables[self::R_SIP] = true;
239 239
                 break;
240 240
             case SoundFiles::class:
241 241
                 $this->modified_tables[self::R_MOH] = true;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                 break;
254 254
             case PbxSettings::class:
255 255
                 $pbxSettings = PbxSettings::findFirstByKey($data['recordId']);
256
-                if ($pbxSettings===null){
256
+                if ($pbxSettings === null) {
257 257
                     return;
258 258
                 }
259 259
                 if ($pbxSettings->itHasFeaturesSettingsChanges()) {
@@ -295,17 +295,17 @@  discard block
 block discarded – undo
295 295
                     $this->modified_tables[self::R_NATS]    = true;
296 296
                 }
297 297
                 if ($pbxSettings->itHasTimeZoneSettings()) {
298
-                    $this->modified_tables[self::R_TIMEZONE]    = true;
299
-                    $this->modified_tables[self::R_NGINX]    = true;
300
-                    $this->modified_tables[self::R_PHP_FPM]    = true;
298
+                    $this->modified_tables[self::R_TIMEZONE] = true;
299
+                    $this->modified_tables[self::R_NGINX] = true;
300
+                    $this->modified_tables[self::R_PHP_FPM] = true;
301 301
                     $this->modified_tables[self::R_REST_API_WORKER] = true;
302 302
                 }
303 303
                 if ($pbxSettings->itHasNTPSettings()) {
304
-                    $this->modified_tables[self::R_NTP]    = true;
304
+                    $this->modified_tables[self::R_NTP] = true;
305 305
                 }
306 306
                 if ($pbxSettings->itHasCallRecordSettings()) {
307
-                    $this->modified_tables[self::R_CALL_EVENTS_WORKER]  = true;
308
-                    $this->modified_tables[self::R_DIALPLAN]  = true;
307
+                    $this->modified_tables[self::R_CALL_EVENTS_WORKER] = true;
308
+                    $this->modified_tables[self::R_DIALPLAN] = true;
309 309
                 }
310 310
                 break;
311 311
             case PbxExtensionModules::class:
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      */
467 467
     public function reloadNginx(): void
468 468
     {
469
-        $nginxConf  = new NginxConf();
469
+        $nginxConf = new NginxConf();
470 470
         $nginxConf->generateConf();
471 471
         $nginxConf->reStart();
472 472
     }
Please login to merge, or discard this patch.
src/PBXCoreREST/Controllers/System/PostController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                 $data = $this->request->getPost();
102 102
                 $this->sendRequestToBackendWorker('system', $actionName, $data);
103 103
                 // Clear WWW models cache after successfully install or remove module
104
-                if ($this->response->getStatusCode()===200){
104
+                if ($this->response->getStatusCode() === 200) {
105 105
                     PbxExtensionModules::clearCache(Extensions::class);
106 106
                     PbxExtensionModules::clearCache(PbxExtensionModules::class);
107 107
                     PbxExtensionModules::clearCache(PbxSettings::class);
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
         $mohDir                = $di->getShared('config')->path('asterisk.mohdir');
127 127
         switch ($category) {
128 128
             case SoundFiles::CATEGORY_MOH:
129
-                $data['filename'] = "{$mohDir}/" . basename($data['temp_filename']);
129
+                $data['filename'] = "{$mohDir}/".basename($data['temp_filename']);
130 130
                 break;
131 131
             case SoundFiles::CATEGORY_CUSTOM:
132
-                $data['filename'] = "{$mediaDir}/" . basename($data['temp_filename']);
132
+                $data['filename'] = "{$mediaDir}/".basename($data['temp_filename']);
133 133
                 break;
134 134
             default:
135 135
                 $this->sendError(400, 'Category not set');
Please login to merge, or discard this patch.
src/Core/Workers/WorkerBeanstalkdTidyUp.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     {
29 29
         $managedCache = $this->di->get('managedCache');
30 30
         $lastTubesCheck = $managedCache->get('lastTubesCheck');
31
-        if ($lastTubesCheck === null){
31
+        if ($lastTubesCheck === null) {
32 32
             $client = new BeanstalkClient();
33 33
             $client->cleanTubes();
34 34
             $managedCache->set('lastTubesCheck', time(), 300);
Please login to merge, or discard this patch.
src/AdminCabinet/Providers/DispatcherProvider.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $di->setShared(
40 40
             self::SERVICE_NAME,
41
-            function () {
41
+            function() {
42 42
                 $eventsManager = new EventsManager();
43 43
 
44 44
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                 /**
62 62
                  * Handle exceptions and not-found exceptions using NotFoundPlugin
63 63
                  */
64
-                if (! class_exists(PrettyPageHandler::class)) {
64
+                if (!class_exists(PrettyPageHandler::class)) {
65 65
                     $eventsManager->attach(
66 66
                         'dispatch:beforeException',
67 67
                         new NotFoundPlugin()
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@
 block discarded – undo
38 38
     {
39 39
         $di->setShared(
40 40
             self::SERVICE_NAME,
41
-            function () {
41
+            function ()
42
+            {
42 43
                 $eventsManager = new EventsManager();
43 44
 
44 45
 
Please login to merge, or discard this patch.