@@ -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) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $arrWorkers = $this->prepareWorkersList(); |
44 | 44 | ReactKernel::start( |
45 | - function () use ($arrWorkers) { |
|
45 | + function() use ($arrWorkers) { |
|
46 | 46 | // Parallel execution https://github.com/recoilphp/recoil |
47 | 47 | foreach ($arrWorkers as $workersWithCurrentType) { |
48 | 48 | foreach ($workersWithCurrentType as $worker) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private function prepareWorkersList(): array |
63 | 63 | { |
64 | - $arrWorkers = [ |
|
64 | + $arrWorkers = [ |
|
65 | 65 | self::CHECK_BY_AMI => |
66 | 66 | [ |
67 | 67 | WorkerAmiListener::class, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | PBX::waitFullyBooted(); |
124 | 124 | $arrWorkers = $this->prepareWorkersList(); |
125 | 125 | ReactKernel::start( |
126 | - function () use ($arrWorkers) { |
|
126 | + function() use ($arrWorkers) { |
|
127 | 127 | // Parallel execution https://github.com/recoilphp/recoil |
128 | 128 | foreach ($arrWorkers as $workerType => $workersWithCurrentType) { |
129 | 129 | foreach ($workersWithCurrentType as $worker) { |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | } catch (\Error $e) { |
175 | 175 | global $errorLogger; |
176 | 176 | $errorLogger->captureException($e); |
177 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
177 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
178 | 178 | } catch (DeadlineSoonException $e) { |
179 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
179 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
180 | 180 | } |
181 | 181 | yield; |
182 | 182 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | } catch (\Error $e) { |
250 | 250 | global $errorLogger; |
251 | 251 | $errorLogger->captureException($e); |
252 | - Util::sysLogMsg($workerClassName . '_EXCEPTION', $e->getMessage()); |
|
252 | + Util::sysLogMsg($workerClassName.'_EXCEPTION', $e->getMessage()); |
|
253 | 253 | } |
254 | 254 | yield; |
255 | 255 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | if (false === $result) { |
164 | 164 | Util::processPHPWorker($workerClassName); |
165 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
165 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
166 | 166 | } |
167 | 167 | $time_elapsed_secs = microtime(true) - $start; |
168 | 168 | if ($time_elapsed_secs > 10) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | if ($res_ping === false && $level < 10) { |
234 | 234 | Util::processPHPWorker($workerClassName); |
235 | - Util::sysLogMsg(__CLASS__, "Service {$workerClassName} started."); |
|
235 | + Util::sysLogMsg(__CLASS__, "service {$workerClassName} started."); |
|
236 | 236 | // Wait 1 second while service will be ready to listen requests |
237 | 237 | sleep(1); |
238 | 238 |
@@ -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 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | /** |
59 | 59 | * @Column(type="string", nullable=true) {'plaintext'|'php'} |
60 | 60 | */ |
61 | - public ?string $type='plaintext'; |
|
61 | + public ?string $type = 'plaintext'; |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @Column(type="string", nullable=true) |
@@ -16,7 +16,7 @@ |
||
16 | 16 | public function indexAction(): void |
17 | 17 | { |
18 | 18 | |
19 | - $this->view->form = new SystemDiagnosticForm(); |
|
19 | + $this->view->form = new SystemDiagnosticForm(); |
|
20 | 20 | |
21 | 21 | // $fileData = FilesManagementProcessor::getLogFromFile(SystemDiagnosticForm::DEFAULT_FILENAME); |
22 | 22 | // if($fileData->success){ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function logRotate(): void |
35 | 35 | { |
36 | - $log_dir = System::getLogDir() . '/nats'; |
|
36 | + $log_dir = System::getLogDir().'/nats'; |
|
37 | 37 | $gnatsdPath = Util::which('gnatsd'); |
38 | 38 | $pid = Util::getPidOfProcess($gnatsdPath, 'custom_modules'); |
39 | 39 | $max_size = 1; |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | if (Util::mFileSize("{$log_dir}/gnatsd.log") > $mb10) { |
63 | 63 | $options = '-f'; |
64 | 64 | } |
65 | - $di = Di::getDefault(); |
|
66 | - if ($di !== null){ |
|
65 | + $di = Di::getDefault(); |
|
66 | + if ($di !== null) { |
|
67 | 67 | $varEtcDir = $di->getShared('config')->path('core.varEtcDir'); |
68 | 68 | } else { |
69 | 69 | $varEtcDir = '/var/etc'; |
70 | 70 | } |
71 | - $path_conf = $varEtcDir . '/gnatsd_logrotate.conf'; |
|
71 | + $path_conf = $varEtcDir.'/gnatsd_logrotate.conf'; |
|
72 | 72 | file_put_contents($path_conf, $text_config); |
73 | 73 | if (file_exists("{$log_dir}/gnatsd.log")) { |
74 | 74 | $logrotatePath = Util::which('logrotate'); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $confdir = '/etc/nats'; |
85 | 85 | Util::mwMkdir($confdir); |
86 | 86 | |
87 | - $logdir = System::getLogDir() . '/nats'; |
|
87 | + $logdir = System::getLogDir().'/nats'; |
|
88 | 88 | Util::mwMkdir($logdir); |
89 | 89 | |
90 | 90 | $tempDir = $this->di->getShared('config')->path('core.tempDir'); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'sessions_path' => $sessionsDir, |
106 | 106 | 'log_file' => "{$logdir}/gnatsd.log", |
107 | 107 | ]; |
108 | - $config = ''; |
|
108 | + $config = ''; |
|
109 | 109 | foreach ($settings as $key => $val) { |
110 | 110 | $config .= "{$key}: {$val} \n"; |
111 | 111 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | $offset_prefix = $offset < 0 ? '-' : '+'; |
92 | 92 | $offset_formatted = gmdate('H:i', $offset); |
93 | 93 | |
94 | - $pretty_offset = "UTC${offset_prefix}${offset_formatted}"; |
|
94 | + $pretty_offset = "utc${offset_prefix}${offset_formatted}"; |
|
95 | 95 | |
96 | 96 | $timezone_list[$timezone] = "$timezone (${pretty_offset})"; |
97 | 97 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $timezone_offsets = []; |
77 | 77 | foreach ($timezones as $timezone) { |
78 | 78 | $tz = new DateTimeZone($timezone); |
79 | - $timezone_offsets[$timezone] = (int)$tz->getOffset(new DateTime()); |
|
79 | + $timezone_offsets[$timezone] = (int) $tz->getOffset(new DateTime()); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // sort timezone by offset |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function saveAction() |
102 | 102 | { |
103 | - if ( ! $this->request->isPost()) { |
|
103 | + if (!$this->request->isPost()) { |
|
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | break; |
123 | 123 | case "NTPServer": |
124 | 124 | $ntp_servers = preg_split('/\r\n|\r|\n| |,/', $data[$key]); |
125 | - if (is_array($ntp_servers)){ |
|
125 | + if (is_array($ntp_servers)) { |
|
126 | 126 | $record->value = implode(PHP_EOL, $ntp_servers); |
127 | 127 | } |
128 | 128 | break; |
129 | 129 | default: |
130 | - if ( ! array_key_exists($key, $data)) { |
|
130 | + if (!array_key_exists($key, $data)) { |
|
131 | 131 | continue 2; |
132 | 132 | } |
133 | 133 | $record->value = $data[$key]; |