@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | use Phalcon\Di\DiInterface; |
14 | 14 | use Phalcon\Di\ServiceProviderInterface; |
15 | 15 | |
16 | -class AmiConnectionCommand implements ServiceProviderInterface{ |
|
16 | +class AmiConnectionCommand implements ServiceProviderInterface { |
|
17 | 17 | |
18 | 18 | public const SERVICE_NAME = 'amiCommander'; |
19 | 19 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | $di->setShared( |
27 | 27 | self::SERVICE_NAME, |
28 | - function () { |
|
28 | + function() { |
|
29 | 29 | $port = PbxSettings::getValueByKey('AMIPort'); |
30 | 30 | $am = new AsteriskManager(); |
31 | 31 | $am->connect("127.0.0.1:{$port}", null, null, 'off'); |
@@ -13,7 +13,8 @@ discard block |
||
13 | 13 | use Phalcon\Di\DiInterface; |
14 | 14 | use Phalcon\Di\ServiceProviderInterface; |
15 | 15 | |
16 | -class AmiConnectionCommand implements ServiceProviderInterface{ |
|
16 | +class AmiConnectionCommand implements ServiceProviderInterface |
|
17 | +{ |
|
17 | 18 | |
18 | 19 | public const SERVICE_NAME = 'amiCommander'; |
19 | 20 | /** |
@@ -25,7 +26,8 @@ discard block |
||
25 | 26 | { |
26 | 27 | $di->setShared( |
27 | 28 | self::SERVICE_NAME, |
28 | - function () { |
|
29 | + function () |
|
30 | + { |
|
29 | 31 | $port = PbxSettings::getValueByKey('AMIPort'); |
30 | 32 | $am = new AsteriskManager(); |
31 | 33 | $am->connect("127.0.0.1:{$port}", null, null, 'off'); |
@@ -32,13 +32,13 @@ |
||
32 | 32 | $phpSessionDir = $di->getShared('config')->path('www.phpSessionDir'); |
33 | 33 | $di->setShared( |
34 | 34 | self::SERVICE_NAME, |
35 | - function () use ($phpSessionDir) { |
|
36 | - if ( ! is_array($_COOKIE) || ! array_key_exists(session_name(), $_COOKIE)) { |
|
35 | + function() use ($phpSessionDir) { |
|
36 | + if (!is_array($_COOKIE) || !array_key_exists(session_name(), $_COOKIE)) { |
|
37 | 37 | return null; |
38 | 38 | } |
39 | 39 | $session_name = preg_replace('/[^\da-z]/i', '', $_COOKIE[session_name()]); |
40 | - $session_file = $phpSessionDir . '/sess_' . $session_name; |
|
41 | - if ( ! file_exists($session_file)) { |
|
40 | + $session_file = $phpSessionDir.'/sess_'.$session_name; |
|
41 | + if (!file_exists($session_file)) { |
|
42 | 42 | return null; |
43 | 43 | } |
44 | 44 |
@@ -32,7 +32,8 @@ |
||
32 | 32 | $phpSessionDir = $di->getShared('config')->path('www.phpSessionDir'); |
33 | 33 | $di->setShared( |
34 | 34 | self::SERVICE_NAME, |
35 | - function () use ($phpSessionDir) { |
|
35 | + function () use ($phpSessionDir) |
|
36 | + { |
|
36 | 37 | if ( ! is_array($_COOKIE) || ! array_key_exists(session_name(), $_COOKIE)) { |
37 | 38 | return null; |
38 | 39 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | use Phalcon\Di\DiInterface; |
14 | 14 | use Phalcon\Di\ServiceProviderInterface; |
15 | 15 | |
16 | -class AmiConnectionListener implements ServiceProviderInterface{ |
|
16 | +class AmiConnectionListener implements ServiceProviderInterface { |
|
17 | 17 | |
18 | 18 | public const SERVICE_NAME = 'amiListner'; |
19 | 19 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $di->setShared( |
28 | 28 | self::SERVICE_NAME, |
29 | - function () { |
|
29 | + function() { |
|
30 | 30 | $port = PbxSettings::getValueByKey('AMIPort'); |
31 | 31 | $am = new AsteriskManager(); |
32 | 32 | $am->connect("127.0.0.1:{$port}", null, null, 'on'); |
@@ -13,7 +13,8 @@ discard block |
||
13 | 13 | use Phalcon\Di\DiInterface; |
14 | 14 | use Phalcon\Di\ServiceProviderInterface; |
15 | 15 | |
16 | -class AmiConnectionListener implements ServiceProviderInterface{ |
|
16 | +class AmiConnectionListener implements ServiceProviderInterface |
|
17 | +{ |
|
17 | 18 | |
18 | 19 | public const SERVICE_NAME = 'amiListner'; |
19 | 20 | |
@@ -26,7 +27,8 @@ discard block |
||
26 | 27 | { |
27 | 28 | $di->setShared( |
28 | 29 | self::SERVICE_NAME, |
29 | - function () { |
|
30 | + function () |
|
31 | + { |
|
30 | 32 | $port = PbxSettings::getValueByKey('AMIPort'); |
31 | 33 | $am = new AsteriskManager(); |
32 | 34 | $am->connect("127.0.0.1:{$port}", null, null, 'on'); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $di->setShared( |
44 | 44 | self::SERVICE_NAME, |
45 | - function (){ |
|
45 | + function() { |
|
46 | 46 | return array_merge( |
47 | 47 | self::getCoreConfModules(), |
48 | 48 | self::getExtensionsConfModules() |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | $configsDir = appPath('src/Core/Asterisk/Configs'); |
62 | 62 | $modulesFiles = glob("{$configsDir}/*.php", GLOB_NOSORT); |
63 | 63 | foreach ($modulesFiles as $file) { |
64 | - $className = pathinfo($file)['filename']; |
|
64 | + $className = pathinfo($file)['filename']; |
|
65 | 65 | $full_class_name = "\\MikoPBX\\Core\\Asterisk\\Configs\\{$className}"; |
66 | 66 | if (class_exists($full_class_name)) { |
67 | 67 | $object = new $full_class_name(); |
68 | - if ($object instanceof ConfigClass){ |
|
68 | + if ($object instanceof ConfigClass) { |
|
69 | 69 | $arrObjects[] = $object; |
70 | 70 | } |
71 | 71 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $full_class_name = "\\Modules\\{$value['uniqid']}\\Lib\\{$class_name}Conf"; |
87 | 87 | if (class_exists($full_class_name)) { |
88 | 88 | $object = new $full_class_name(); |
89 | - if ($object instanceof ConfigClass){ |
|
89 | + if ($object instanceof ConfigClass) { |
|
90 | 90 | $arrObjects[] = $object; |
91 | 91 | } |
92 | 92 | } |
@@ -42,7 +42,8 @@ |
||
42 | 42 | { |
43 | 43 | $di->setShared( |
44 | 44 | self::SERVICE_NAME, |
45 | - function (){ |
|
45 | + function () |
|
46 | + { |
|
46 | 47 | return array_merge( |
47 | 48 | self::getCoreConfModules(), |
48 | 49 | self::getExtensionsConfModules() |
@@ -83,7 +83,7 @@ |
||
83 | 83 | $modules = PbxExtensionModules::find('disabled="0"')->toArray(); |
84 | 84 | foreach ($modules as $value) { |
85 | 85 | $class_name = str_replace('Module', '', $value['uniqid']); |
86 | - $full_class_name = "\\Modules\\{$value['uniqid']}\\Lib\\{$class_name}Conf"; |
|
86 | + $full_class_name = "\\Modules\\{$value['uniqid']}\\Lib\\{$class_name}conf"; |
|
87 | 87 | if (class_exists($full_class_name)) { |
88 | 88 | $object = new $full_class_name(); |
89 | 89 | if ($object instanceof ConfigClass){ |
@@ -41,7 +41,7 @@ |
||
41 | 41 | { |
42 | 42 | $di->setShared( |
43 | 43 | self::SERVICE_NAME, |
44 | - function () use ($di) { |
|
44 | + function() use ($di) { |
|
45 | 45 | $interpolator = new InterpolatorFactory(); |
46 | 46 | $factory = new TranslateFactory($interpolator); |
47 | 47 |
@@ -41,7 +41,8 @@ |
||
41 | 41 | { |
42 | 42 | $di->setShared( |
43 | 43 | self::SERVICE_NAME, |
44 | - function () use ($di) { |
|
44 | + function () use ($di) |
|
45 | + { |
|
45 | 46 | $interpolator = new InterpolatorFactory(); |
46 | 47 | $factory = new TranslateFactory($interpolator); |
47 | 48 |
@@ -35,15 +35,15 @@ |
||
35 | 35 | { |
36 | 36 | $configPath = '/etc/inc/mikopbx-settings.json'; |
37 | 37 | |
38 | - if ( ! file_exists($configPath) |
|
39 | - || ! is_readable($configPath) |
|
38 | + if (!file_exists($configPath) |
|
39 | + || !is_readable($configPath) |
|
40 | 40 | ) { |
41 | - throw new Exception('Config file does not exist: ' . $configPath); |
|
41 | + throw new Exception('Config file does not exist: '.$configPath); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $di->setShared( |
45 | 45 | self::SERVICE_NAME, |
46 | - function () use ($configPath) { |
|
46 | + function() use ($configPath) { |
|
47 | 47 | return new Json($configPath); |
48 | 48 | } |
49 | 49 | ); |
@@ -43,7 +43,8 @@ |
||
43 | 43 | |
44 | 44 | $di->setShared( |
45 | 45 | self::SERVICE_NAME, |
46 | - function () use ($configPath) { |
|
46 | + function () use ($configPath) |
|
47 | + { |
|
47 | 48 | return new Json($configPath); |
48 | 49 | } |
49 | 50 | ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | $di->setShared( |
49 | 49 | self::SERVICE_NAME, |
50 | - function () use ($tempDir){ |
|
50 | + function() use ($tempDir){ |
|
51 | 51 | $serializerFactory = new SerializerFactory(); |
52 | 52 | $options = [ |
53 | 53 | 'defaultSerializer' => 'php', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'storageDir' => $tempDir |
56 | 56 | ]; |
57 | 57 | |
58 | - $adapter = new Stream ($serializerFactory, $options); |
|
58 | + $adapter = new Stream($serializerFactory, $options); |
|
59 | 59 | return new Cache($adapter); |
60 | 60 | } |
61 | 61 | ); |
@@ -47,7 +47,8 @@ |
||
47 | 47 | |
48 | 48 | $di->setShared( |
49 | 49 | self::SERVICE_NAME, |
50 | - function () use ($tempDir){ |
|
50 | + function () use ($tempDir) |
|
51 | + { |
|
51 | 52 | $serializerFactory = new SerializerFactory(); |
52 | 53 | $options = [ |
53 | 54 | 'defaultSerializer' => 'php', |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $di->setShared( |
42 | 42 | self::SERVICE_NAME, |
43 | - function () { |
|
43 | + function() { |
|
44 | 44 | $metaData = new Memory( |
45 | 45 | [ |
46 | 46 | 'lifetime' => 600, |
@@ -40,7 +40,8 @@ |
||
40 | 40 | { |
41 | 41 | $di->setShared( |
42 | 42 | self::SERVICE_NAME, |
43 | - function () { |
|
43 | + function () |
|
44 | + { |
|
44 | 45 | $metaData = new Memory( |
45 | 46 | [ |
46 | 47 | 'lifetime' => 600, |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | $coreConfig = $di->getShared('config')->path('core'); |
34 | 34 | $di->setShared( |
35 | 35 | self::SERVICE_NAME, |
36 | - function () use ($di, $coreConfig) { |
|
36 | + function() use ($di, $coreConfig) { |
|
37 | 37 | $cacheKey = false; |
38 | - if (php_sapi_name() === 'cli'){ |
|
39 | - if (cli_get_process_title()=== WorkerApiCommands::class){ |
|
38 | + if (php_sapi_name() === 'cli') { |
|
39 | + if (cli_get_process_title() === WorkerApiCommands::class) { |
|
40 | 40 | $language = PbxSettings::getValueByKey('WebAdminLanguage'); |
41 | 41 | } elseif (!empty($_ENV['SSH_CLIENT'])) { |
42 | 42 | $language = 'en'; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $language = $di->get('language'); |
48 | 48 | $session = $di->get('session'); |
49 | 49 | if ($session !== null && $session->has('versionHash')) { |
50 | - $cacheKey = 'LocalisationArray' . $session->get('versionHash') . $language . '.php'; |
|
50 | + $cacheKey = 'LocalisationArray'.$session->get('versionHash').$language.'.php'; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | // Возьмем английский перевод расширений |
84 | 84 | $extensionsTranslates = [[]]; |
85 | - $results = glob($coreConfig->modulesDir . '/*/{Messages}/en.php', GLOB_BRACE); |
|
85 | + $results = glob($coreConfig->modulesDir.'/*/{Messages}/en.php', GLOB_BRACE); |
|
86 | 86 | foreach ($results as $path) { |
87 | 87 | $langArr = require $path; |
88 | 88 | if (is_array($langArr)) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | if ($language !== 'en') { |
96 | 96 | $additionalTranslates = [[]]; |
97 | 97 | $results = glob( |
98 | - $coreConfig->modulesDir . "/*/{Messages}/{$language}.php", |
|
98 | + $coreConfig->modulesDir."/*/{Messages}/{$language}.php", |
|
99 | 99 | GLOB_BRACE |
100 | 100 | ); |
101 | 101 | foreach ($results as $path) { |
@@ -33,7 +33,8 @@ |
||
33 | 33 | $coreConfig = $di->getShared('config')->path('core'); |
34 | 34 | $di->setShared( |
35 | 35 | self::SERVICE_NAME, |
36 | - function () use ($di, $coreConfig) { |
|
36 | + function () use ($di, $coreConfig) |
|
37 | + { |
|
37 | 38 | $cacheKey = false; |
38 | 39 | if (php_sapi_name() === 'cli'){ |
39 | 40 | if (cli_get_process_title()=== WorkerApiCommands::class){ |