@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->setConnectionService("{$this->moduleUniqueId}_module_db"); |
34 | 34 | } |
35 | 35 | parent::initialize(); |
36 | - $this->initialized=true; |
|
36 | + $this->initialized = true; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function getRepresent($needLink = false): string |
47 | 47 | { |
48 | - if (!$this->initialized){ |
|
48 | + if (!$this->initialized) { |
|
49 | 49 | $this->initialize(); |
50 | 50 | } |
51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | if (isset($this->moduleUniqueId)) { |
57 | 57 | $name = '<i class="puzzle piece icon"></i> ' |
58 | - . $this->t('mo_' . $this->moduleUniqueId); |
|
58 | + . $this->t('mo_'.$this->moduleUniqueId); |
|
59 | 59 | } else { |
60 | 60 | $name = 'Unknown'; |
61 | 61 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $link = $this->getWebInterfaceLink(); |
68 | 68 | |
69 | 69 | $result = $this->t( |
70 | - 'rep' . $this->moduleUniqueId, |
|
70 | + 'rep'.$this->moduleUniqueId, |
|
71 | 71 | [ |
72 | 72 | 'represent' => "<a href='{$link}'>{$name}</a>", |
73 | 73 | ] |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function getWebInterfaceLink(): string |
88 | 88 | { |
89 | - if (!$this->initialized){ |
|
89 | + if (!$this->initialized) { |
|
90 | 90 | $this->initialize(); |
91 | 91 | } |
92 | 92 | if (isset($this->moduleUniqueId)) { |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | return [ |
3 | 3 | /** |
4 | - * Copyright © MIKO LLC - All Rights Reserved |
|
5 | - * Unauthorized copying of this file, via any medium is strictly prohibited |
|
6 | - * Proprietary and confidential |
|
7 | - * Written by Alexey Portnov, 8 2020 |
|
8 | - */ |
|
4 | + * Copyright © MIKO LLC - All Rights Reserved |
|
5 | + * Unauthorized copying of this file, via any medium is strictly prohibited |
|
6 | + * Proprietary and confidential |
|
7 | + * Written by Alexey Portnov, 8 2020 |
|
8 | + */ |
|
9 | 9 | 'January' => 'January', |
10 | 10 | 'February' => 'February', |
11 | 11 | 'March' => 'March', |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $conf .= $this->generateGeneral(); |
31 | 31 | $conf .= $this->generateProviders(); |
32 | 32 | |
33 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/iax.conf', $conf); |
|
34 | - file_put_contents($this->config->path('asterisk.astetcdir') . '/iaxprov.conf', "[default]\ncodec=alaw\n"); |
|
33 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/iax.conf', $conf); |
|
34 | + file_put_contents($this->config->path('asterisk.astetcdir').'/iaxprov.conf', "[default]\ncodec=alaw\n"); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private function getProviders(): array |
42 | 42 | { |
43 | - $data_providers =[]; |
|
43 | + $data_providers = []; |
|
44 | 44 | // Получим настройки всех аккаунтов. |
45 | - $arrIaxProviders = Iax::find("disabled IS NULL OR disabled = '0'"); |
|
45 | + $arrIaxProviders = Iax::find("disabled IS NULL OR disabled = '0'"); |
|
46 | 46 | foreach ($arrIaxProviders as $peer) { |
47 | 47 | /** @var \MikoPBX\Common\Models\Iax $peer */ |
48 | 48 | $arr_data = $peer->toArray(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'conditions'=>'disabled="0"', |
57 | 57 | 'order' => 'type, priority', |
58 | 58 | ]; |
59 | - $codecs = Codecs::find($filter); |
|
59 | + $codecs = Codecs::find($filter); |
|
60 | 60 | foreach ($codecs as $ob_codec) { |
61 | 61 | $arr_data['codecs'][] = $ob_codec->name; |
62 | 62 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | private function generateGeneral(): string |
93 | 93 | { |
94 | 94 | $iax_port = (trim($this->generalSettings['IAXPort']) !== '') ? $this->generalSettings['IAXPort'] : '4569'; |
95 | - $conf = '[general]' . "\n"; |
|
95 | + $conf = '[general]'."\n"; |
|
96 | 96 | // $conf .= "context=public-direct-dial \n"; |
97 | 97 | $conf .= "bindport={$iax_port}\n"; |
98 | 98 | $conf .= "bindaddr=0.0.0.0\n"; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | $secret = (trim($provider['secret']) == '') ? '' : ":{$provider['secret']}"; |
153 | 153 | $host = $provider['host']; |
154 | 154 | // $port = (trim($provider['port']) =='')?'':":{$provider['port']}"; |
155 | - $port = ''; |
|
155 | + $port = ''; |
|
156 | 156 | $reg_strings .= "register => {$user}{$secret}@{$host}{$port} \n"; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - return $reg_strings . "\n" . $prov_config; |
|
160 | + return $reg_strings."\n".$prov_config; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | } |
@@ -91,10 +91,10 @@ |
||
91 | 91 | |
92 | 92 | $codecs = json_decode($data['codecs'], true); |
93 | 93 | foreach ($codecs as $codec){ |
94 | - $record = Codecs::findFirstById($codec['codecId']); |
|
95 | - $record->priority = $codec['priority']; |
|
96 | - $record->disabled = $codec['disabled']===true?'1':'0'; |
|
97 | - $record->update(); |
|
94 | + $record = Codecs::findFirstById($codec['codecId']); |
|
95 | + $record->priority = $codec['priority']; |
|
96 | + $record->disabled = $codec['disabled']===true?'1':'0'; |
|
97 | + $record->update(); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $this->flash->success($this->translation->_('ms_SuccessfulSaved')); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function saveAction(): void |
41 | 41 | { |
42 | - if ( ! $this->request->isPost()) { |
|
42 | + if (!$this->request->isPost()) { |
|
43 | 43 | return; |
44 | 44 | } |
45 | 45 | $data = $this->request->getPost(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->session->set('SendMetrics', $record->value); |
77 | 77 | break; |
78 | 78 | case 'PBXFeatureTransferDigitTimeout': |
79 | - $record->value = ceil((int)$data['PBXFeatureDigitTimeout']/1000); |
|
79 | + $record->value = ceil((int) $data['PBXFeatureDigitTimeout'] / 1000); |
|
80 | 80 | break; |
81 | 81 | default: |
82 | 82 | if (array_key_exists($key, $data)) { |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $codecs = json_decode($data['codecs'], true); |
97 | - foreach ($codecs as $codec){ |
|
97 | + foreach ($codecs as $codec) { |
|
98 | 98 | $record = Codecs::findFirstById($codec['codecId']); |
99 | 99 | $record->priority = $codec['priority']; |
100 | - $record->disabled = $codec['disabled']===true?'1':'0'; |
|
100 | + $record->disabled = $codec['disabled'] === true ? '1' : '0'; |
|
101 | 101 | $record->update(); |
102 | 102 | } |
103 | 103 |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | if ($this->request->isAjax()) { |
37 | 37 | if ($controller !== 'SESSION') { |
38 | 38 | $sessionRo = $this->di->getShared('sessionRO'); |
39 | - if ( ! is_array($sessionRo) |
|
40 | - || ! array_key_exists('auth', $sessionRo) |
|
39 | + if (!is_array($sessionRo) |
|
40 | + || !array_key_exists('auth', $sessionRo) |
|
41 | 41 | ) { |
42 | 42 | $this->response->setStatusCode(403, 'Forbidden') |
43 | 43 | ->sendHeaders(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | } else { // не AJAX запрос |
51 | 51 | $auth = $this->session->get('auth'); |
52 | - if ( ! $auth && $controller !== 'SESSION') { |
|
52 | + if (!$auth && $controller !== 'SESSION') { |
|
53 | 53 | $dispatcher->forward( |
54 | 54 | [ |
55 | 55 | 'controller' => 'session', |
@@ -52,7 +52,8 @@ discard block |
||
52 | 52 | { |
53 | 53 | $arrWorkers = $this->prepareWorkersList(); |
54 | 54 | ReactKernel::start( |
55 | - function () use ($arrWorkers) { |
|
55 | + function () use ($arrWorkers) |
|
56 | + { |
|
56 | 57 | // Parallel execution https://github.com/recoilphp/recoil |
57 | 58 | foreach ($arrWorkers as $workersWithCurrentType) { |
58 | 59 | foreach ($workersWithCurrentType as $worker) { |
@@ -132,7 +133,8 @@ discard block |
||
132 | 133 | PBX::waitFullyBooted(); |
133 | 134 | $arrWorkers = $this->prepareWorkersList(); |
134 | 135 | ReactKernel::start( |
135 | - function () use ($arrWorkers) { |
|
136 | + function () use ($arrWorkers) |
|
137 | + { |
|
136 | 138 | // Parallel execution https://github.com/recoilphp/recoil |
137 | 139 | foreach ($arrWorkers as $workerType => $workersWithCurrentType) { |
138 | 140 | foreach ($workersWithCurrentType as $worker) { |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | if (false === $result) { |
167 | 167 | Processes::processPHPWorker($workerClassName); |
168 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
168 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
169 | 169 | } |
170 | 170 | $time_elapsed_secs = microtime(true) - $start; |
171 | 171 | if ($time_elapsed_secs > 10) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | if ($res_ping === false && $level < 10) { |
235 | 235 | Processes::processPHPWorker($workerClassName); |
236 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
236 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
237 | 237 | // Wait 1 second while service will be ready to listen requests |
238 | 238 | sleep(1); |
239 | 239 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $arrWorkers = $this->prepareWorkersList(); |
46 | 46 | ReactKernel::start( |
47 | - function () use ($arrWorkers) { |
|
47 | + function() use ($arrWorkers) { |
|
48 | 48 | // Parallel execution https://github.com/recoilphp/recoil |
49 | 49 | foreach ($arrWorkers as $workersWithCurrentType) { |
50 | 50 | foreach ($workersWithCurrentType as $worker) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | private function prepareWorkersList(): array |
65 | 65 | { |
66 | - $arrWorkers = [ |
|
66 | + $arrWorkers = [ |
|
67 | 67 | self::CHECK_BY_AMI => |
68 | 68 | [ |
69 | 69 | WorkerAmiListener::class, |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function restartWorker($workerClassName): ?Generator |
112 | 112 | { |
113 | - Processes::processPHPWorker($workerClassName, 'start','restart'); |
|
113 | + Processes::processPHPWorker($workerClassName, 'start', 'restart'); |
|
114 | 114 | yield; |
115 | 115 | } |
116 | 116 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | PBX::waitFullyBooted(); |
127 | 127 | $arrWorkers = $this->prepareWorkersList(); |
128 | 128 | ReactKernel::start( |
129 | - function () use ($arrWorkers) { |
|
129 | + function() use ($arrWorkers) { |
|
130 | 130 | // Parallel execution https://github.com/recoilphp/recoil |
131 | 131 | foreach ($arrWorkers as $workerType => $workersWithCurrentType) { |
132 | 132 | foreach ($workersWithCurrentType as $worker) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } catch (Throwable $e) { |
178 | 178 | global $errorLogger; |
179 | 179 | $errorLogger->captureException($e); |
180 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
180 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
181 | 181 | } |
182 | 182 | yield; |
183 | 183 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | } catch (Throwable $e) { |
251 | 251 | global $errorLogger; |
252 | 252 | $errorLogger->captureException($e); |
253 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
253 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
254 | 254 | } |
255 | 255 | yield; |
256 | 256 | } |
@@ -19,8 +19,8 @@ |
||
19 | 19 | { |
20 | 20 | $managedCache = $this->di->get('managedCache'); |
21 | 21 | $lastLicenseCheck = $managedCache->get('lastLicenseCheck'); |
22 | - if ($lastLicenseCheck===null){ |
|
23 | - $lic = $this->di->getShared('license'); |
|
22 | + if ($lastLicenseCheck === null) { |
|
23 | + $lic = $this->di->getShared('license'); |
|
24 | 24 | $lic->checkPBX(); |
25 | 25 | $lic->checkModules(); |
26 | 26 | $managedCache->set('lastLicenseCheck', time(), 3600); |
@@ -65,18 +65,18 @@ |
||
65 | 65 | */ |
66 | 66 | public function thisIsModuleNoAuthRequest(Micro $api): bool |
67 | 67 | { |
68 | - $pattern = $api->request->getURI(true); |
|
68 | + $pattern = $api->request->getURI(true); |
|
69 | 69 | $additionalModules = $api->getService('pbxConfModules'); |
70 | 70 | foreach ($additionalModules as $appClass) { |
71 | 71 | /** @var \MikoPBX\Modules\Config\ConfigClass; $appClass */ |
72 | 72 | $additionalRoutes = $appClass->getPBXCoreRESTAdditionalRoutes(); |
73 | - if(!is_array($additionalRoutes)){ |
|
73 | + if (!is_array($additionalRoutes)) { |
|
74 | 74 | continue; |
75 | 75 | } |
76 | - foreach ($additionalRoutes as $additionalRoute){ |
|
77 | - $noAuth = $additionalRoute[5]??false; |
|
78 | - if ($noAuth===true |
|
79 | - && stripos($pattern, $additionalRoute[2])!==0){ |
|
76 | + foreach ($additionalRoutes as $additionalRoute) { |
|
77 | + $noAuth = $additionalRoute[5] ?? false; |
|
78 | + if ($noAuth === true |
|
79 | + && stripos($pattern, $additionalRoute[2]) !== 0) { |
|
80 | 80 | return true; // Allow request without authentication |
81 | 81 | } |
82 | 82 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | use ReflectionClass as ReflectionClassAlias; |
16 | 16 | |
17 | 17 | abstract class ConfigClass extends Injectable implements SystemConfigInterface, AsteriskConfigInterface, |
18 | - RestAPIConfigInterface |
|
18 | + RestAPIConfigInterface |
|
19 | 19 | { |
20 | 20 | |
21 | 21 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if (count($partsOfNameSpace) === 3 && $partsOfNameSpace[0] === 'Modules') { |
85 | 85 | $modulesDir = $this->config->path('core.modulesDir'); |
86 | 86 | $this->moduleUniqueId = $partsOfNameSpace[1]; |
87 | - $this->moduleDir = $modulesDir . '/' . $this->moduleUniqueId; |
|
87 | + $this->moduleDir = $modulesDir.'/'.$this->moduleUniqueId; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $this->messages = []; |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | if (empty($addition)) { |
118 | 118 | return $result; |
119 | 119 | } |
120 | - if ( ! empty($this->moduleUniqueId) && ConfigClass::ID_CONFIG_CLASS !== $this->moduleUniqueId) { |
|
121 | - $result = PHP_EOL . '; ***** BEGIN BY ' . $this->moduleUniqueId . PHP_EOL; |
|
120 | + if (!empty($this->moduleUniqueId) && ConfigClass::ID_CONFIG_CLASS !== $this->moduleUniqueId) { |
|
121 | + $result = PHP_EOL.'; ***** BEGIN BY '.$this->moduleUniqueId.PHP_EOL; |
|
122 | 122 | $result .= $addition; |
123 | 123 | if (substr($addition, -1) !== "\t") { |
124 | 124 | $result .= "\t"; |
125 | 125 | } |
126 | - $result .= PHP_EOL . '; ***** END BY ' . $this->moduleUniqueId . PHP_EOL; |
|
126 | + $result .= PHP_EOL.'; ***** END BY '.$this->moduleUniqueId.PHP_EOL; |
|
127 | 127 | } else { |
128 | 128 | $result .= $addition; |
129 | 129 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | protected function echoGenerateConfig(): void |
139 | 139 | { |
140 | - if ($this->booting === true && ! empty($this->description)) { |
|
140 | + if ($this->booting === true && !empty($this->description)) { |
|
141 | 141 | echo " |- generate config {$this->description}... "; |
142 | 142 | } |
143 | 143 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function echoDone(): void |
156 | 156 | { |
157 | - if ($this->booting === true && ! empty($this->description)) { |
|
157 | + if ($this->booting === true && !empty($this->description)) { |
|
158 | 158 | echo "\033[32;1mdone\033[0m \n"; |
159 | 159 | } |
160 | 160 | } |