@@ -60,8 +60,7 @@ |
||
60 | 60 | echo "\n\n"; |
61 | 61 | echo " > Check realized on ".$options['a']; |
62 | 62 | echo "\n\n"; |
63 | - } |
|
64 | - else { |
|
63 | + } else { |
|
65 | 64 | echo "\n\n"; |
66 | 65 | echo Bash::setBackground(" ", 'red'); |
67 | 66 | echo Bash::setBackground(" [WARNING] A web server is not used ", 'red'); |
@@ -7,68 +7,68 @@ |
||
7 | 7 | |
8 | 8 | class Server extends Controller |
9 | 9 | { |
10 | - /** |
|
11 | - * new method to launch a web server |
|
12 | - * @param array $options |
|
13 | - * @tutorial php bin/console server:run |
|
14 | - * php bin/console server:run -a 192.168.0.1:8000 |
|
15 | - */ |
|
16 | - public function run(array $options = array()) |
|
17 | - { |
|
18 | - ob_get_clean(); |
|
10 | + /** |
|
11 | + * new method to launch a web server |
|
12 | + * @param array $options |
|
13 | + * @tutorial php bin/console server:run |
|
14 | + * php bin/console server:run -a 192.168.0.1:8000 |
|
15 | + */ |
|
16 | + public function run(array $options = array()) |
|
17 | + { |
|
18 | + ob_get_clean(); |
|
19 | 19 | |
20 | - if (!isset($options['a'])) { |
|
21 | - $options['a'] = 'localhost:8000'; |
|
22 | - } |
|
20 | + if (!isset($options['a'])) { |
|
21 | + $options['a'] = 'localhost:8000'; |
|
22 | + } |
|
23 | 23 | |
24 | - echo "\n\n"; |
|
25 | - echo Bash::setBackground(" ", 'green'); |
|
26 | - echo Bash::setBackground(" [OK] Start web server ", 'green'); |
|
27 | - echo Bash::setBackground(" ", 'green'); |
|
28 | - echo "\n\n"; |
|
29 | - echo " > Use ".$options['a']." in browser"; |
|
30 | - echo "\n\n"; |
|
31 | - echo " > Clic Ctrl+C to stop the web server"; |
|
32 | - echo "\n\n"; |
|
24 | + echo "\n\n"; |
|
25 | + echo Bash::setBackground(" ", 'green'); |
|
26 | + echo Bash::setBackground(" [OK] Start web server ", 'green'); |
|
27 | + echo Bash::setBackground(" ", 'green'); |
|
28 | + echo "\n\n"; |
|
29 | + echo " > Use ".$options['a']." in browser"; |
|
30 | + echo "\n\n"; |
|
31 | + echo " > Clic Ctrl+C to stop the web server"; |
|
32 | + echo "\n\n"; |
|
33 | 33 | |
34 | - exec('php -S '.$options['a'].' /public/index.php'); |
|
35 | - } |
|
34 | + exec('php -S '.$options['a'].' /public/index.php'); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * check if a server web is launched |
|
39 | - * @param array $options |
|
40 | - * @tutorial php bin/console server:status |
|
41 | - * php bin/console server:status -a 192.168.0.1:8000 |
|
42 | - */ |
|
43 | - public function status(array $options = array()) |
|
44 | - { |
|
45 | - ob_get_clean(); |
|
37 | + /** |
|
38 | + * check if a server web is launched |
|
39 | + * @param array $options |
|
40 | + * @tutorial php bin/console server:status |
|
41 | + * php bin/console server:status -a 192.168.0.1:8000 |
|
42 | + */ |
|
43 | + public function status(array $options = array()) |
|
44 | + { |
|
45 | + ob_get_clean(); |
|
46 | 46 | |
47 | - if (!isset($options['a'])) { |
|
48 | - $options['a'] = 'localhost:8000'; |
|
49 | - } |
|
47 | + if (!isset($options['a'])) { |
|
48 | + $options['a'] = 'localhost:8000'; |
|
49 | + } |
|
50 | 50 | |
51 | - list($hostname, $port) = explode(':', $options['a']); |
|
51 | + list($hostname, $port) = explode(':', $options['a']); |
|
52 | 52 | |
53 | - if (false !== $fp = @fsockopen($hostname, $port, $errno, $errstr, 1)) { |
|
54 | - fclose($fp); |
|
53 | + if (false !== $fp = @fsockopen($hostname, $port, $errno, $errstr, 1)) { |
|
54 | + fclose($fp); |
|
55 | 55 | |
56 | - echo "\n\n"; |
|
57 | - echo Bash::setBackground(" ", 'green'); |
|
58 | - echo Bash::setBackground(" [OK] A web server is launched ", 'green'); |
|
59 | - echo Bash::setBackground(" ", 'green'); |
|
60 | - echo "\n\n"; |
|
61 | - echo " > Check realized on ".$options['a']; |
|
62 | - echo "\n\n"; |
|
63 | - } |
|
64 | - else { |
|
65 | - echo "\n\n"; |
|
66 | - echo Bash::setBackground(" ", 'red'); |
|
67 | - echo Bash::setBackground(" [WARNING] A web server is not used ", 'red'); |
|
68 | - echo Bash::setBackground(" ", 'red'); |
|
69 | - echo "\n\n"; |
|
70 | - echo " > Check realized on ".$options['a']; |
|
71 | - echo "\n\n"; |
|
72 | - } |
|
73 | - } |
|
56 | + echo "\n\n"; |
|
57 | + echo Bash::setBackground(" ", 'green'); |
|
58 | + echo Bash::setBackground(" [OK] A web server is launched ", 'green'); |
|
59 | + echo Bash::setBackground(" ", 'green'); |
|
60 | + echo "\n\n"; |
|
61 | + echo " > Check realized on ".$options['a']; |
|
62 | + echo "\n\n"; |
|
63 | + } |
|
64 | + else { |
|
65 | + echo "\n\n"; |
|
66 | + echo Bash::setBackground(" ", 'red'); |
|
67 | + echo Bash::setBackground(" [WARNING] A web server is not used ", 'red'); |
|
68 | + echo Bash::setBackground(" ", 'red'); |
|
69 | + echo "\n\n"; |
|
70 | + echo " > Check realized on ".$options['a']; |
|
71 | + echo "\n\n"; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | } |
@@ -37,10 +37,10 @@ |
||
37 | 37 | |
38 | 38 | foreach ($controllerFiles as $oneController) { |
39 | 39 | |
40 | - if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController) && $oneController != '..' && $oneController != '.') { |
|
40 | + if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/'.$oneController) && $oneController != '..' && $oneController != '.') { |
|
41 | 41 | |
42 | 42 | $unitTest = new \PHPUnit_TextUI_Command; |
43 | - $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController]); |
|
43 | + $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/'.$oneController]); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -6,42 +6,42 @@ |
||
6 | 6 | |
7 | 7 | class Phpunit extends Controller |
8 | 8 | { |
9 | - /** |
|
10 | - * Constructs a test case with the given name. |
|
11 | - * |
|
12 | - */ |
|
13 | - public function __construct() |
|
14 | - { |
|
15 | - parent::__construct(); |
|
16 | - } |
|
17 | - |
|
18 | - /** |
|
19 | - * new method to launch a web server |
|
20 | - * @param array $options |
|
21 | - * @tutorial php bin/console server:run |
|
22 | - * php bin/console server:run -a 192.168.0.1:8000 |
|
23 | - */ |
|
24 | - public function phpunit(array $options = array()) |
|
25 | - { |
|
26 | - ob_get_clean(); |
|
27 | - |
|
28 | - $files = scandir(__DIR__.'/../../../../tests'); |
|
29 | - |
|
30 | - foreach ($files as $one) { |
|
31 | - |
|
32 | - if (is_dir(__DIR__.'/../../../../tests/'.$one) && $one != '..' && $one != '.') { |
|
33 | - |
|
34 | - $controllerFiles = scandir(__DIR__.'/../../../../tests'.'/'.$one.'/app/Controller'); |
|
35 | - |
|
36 | - foreach ($controllerFiles as $oneController) { |
|
37 | - |
|
38 | - if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController) && $oneController != '..' && $oneController != '.') { |
|
39 | - |
|
40 | - $unitTest = new \PHPUnit_TextUI_Command; |
|
41 | - $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController]); |
|
42 | - } |
|
43 | - } |
|
44 | - } |
|
45 | - } |
|
46 | - } |
|
9 | + /** |
|
10 | + * Constructs a test case with the given name. |
|
11 | + * |
|
12 | + */ |
|
13 | + public function __construct() |
|
14 | + { |
|
15 | + parent::__construct(); |
|
16 | + } |
|
17 | + |
|
18 | + /** |
|
19 | + * new method to launch a web server |
|
20 | + * @param array $options |
|
21 | + * @tutorial php bin/console server:run |
|
22 | + * php bin/console server:run -a 192.168.0.1:8000 |
|
23 | + */ |
|
24 | + public function phpunit(array $options = array()) |
|
25 | + { |
|
26 | + ob_get_clean(); |
|
27 | + |
|
28 | + $files = scandir(__DIR__.'/../../../../tests'); |
|
29 | + |
|
30 | + foreach ($files as $one) { |
|
31 | + |
|
32 | + if (is_dir(__DIR__.'/../../../../tests/'.$one) && $one != '..' && $one != '.') { |
|
33 | + |
|
34 | + $controllerFiles = scandir(__DIR__.'/../../../../tests'.'/'.$one.'/app/Controller'); |
|
35 | + |
|
36 | + foreach ($controllerFiles as $oneController) { |
|
37 | + |
|
38 | + if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController) && $oneController != '..' && $oneController != '.') { |
|
39 | + |
|
40 | + $unitTest = new \PHPUnit_TextUI_Command; |
|
41 | + $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController]); |
|
42 | + } |
|
43 | + } |
|
44 | + } |
|
45 | + } |
|
46 | + } |
|
47 | 47 | } |
@@ -47,20 +47,20 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function install(array $aOptions = array()) |
49 | 49 | { |
50 | - $sFile = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Plugins.conf'); |
|
51 | - $aPlugins = json_decode($sFile); |
|
50 | + $sFile = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Plugins.conf'); |
|
51 | + $aPlugins = json_decode($sFile); |
|
52 | 52 | |
53 | - if (isset($aOptions['p'])) { |
|
53 | + if (isset($aOptions['p'])) { |
|
54 | 54 | |
55 | - define('CREATE_PORTAL', $aOptions['p']); |
|
56 | - } |
|
55 | + define('CREATE_PORTAL', $aOptions['p']); |
|
56 | + } |
|
57 | 57 | |
58 | - foreach ($aPlugins->list as $sPluginName) { |
|
58 | + foreach ($aPlugins->list as $sPluginName) { |
|
59 | 59 | |
60 | - $sClassName = 'Venus\src\plugins\\'.$sPluginName.'\Controller\\'.$sPluginName; |
|
61 | - $oPlugin = new $sClassName; |
|
62 | - $oPlugin->install($aOptions['p']); |
|
63 | - } |
|
60 | + $sClassName = 'Venus\src\plugins\\'.$sPluginName.'\Controller\\'.$sPluginName; |
|
61 | + $oPlugin = new $sClassName; |
|
62 | + $oPlugin->install($aOptions['p']); |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -73,23 +73,23 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function create(array $aOptions = array()) |
75 | 75 | { |
76 | - $sDefaultFolder = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$aOptions['n']; |
|
77 | - mkdir($sDefaultFolder, 0777, true); |
|
78 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'conf', 0777, true); |
|
79 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'Controller', 0777, true); |
|
80 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'data', 0777, true); |
|
81 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'i18n', 0777, true); |
|
82 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'meta', 0777, true); |
|
83 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public', 0777, true); |
|
84 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'css', 0777, true); |
|
85 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'img', 0777, true); |
|
86 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'js', 0777, true); |
|
87 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'View', 0777, true); |
|
76 | + $sDefaultFolder = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$aOptions['n']; |
|
77 | + mkdir($sDefaultFolder, 0777, true); |
|
78 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'conf', 0777, true); |
|
79 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'Controller', 0777, true); |
|
80 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'data', 0777, true); |
|
81 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'i18n', 0777, true); |
|
82 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'meta', 0777, true); |
|
83 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public', 0777, true); |
|
84 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'css', 0777, true); |
|
85 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'img', 0777, true); |
|
86 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'js', 0777, true); |
|
87 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'View', 0777, true); |
|
88 | 88 | |
89 | - file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Db.conf', '{}'); |
|
90 | - file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Plugin.conf', '{}'); |
|
89 | + file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Db.conf', '{}'); |
|
90 | + file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'Plugin.conf', '{}'); |
|
91 | 91 | |
92 | - $sContent = "<?php |
|
92 | + $sContent = "<?php |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Controller of the plugin ".$aOptions['n']." |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | } |
158 | 158 | }"; |
159 | 159 | |
160 | - file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'Controller'.DIRECTORY_SEPARATOR.$aOptions['n'].'.php', $sContent); |
|
161 | - mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'i18n'.DIRECTORY_SEPARATOR.'en_US'.DIRECTORY_SEPARATOR.'LC_MESSAGES', 0777, true); |
|
162 | - file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'meta'.DIRECTORY_SEPARATOR.'LICENSE.md', ''); |
|
163 | - file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'meta'.DIRECTORY_SEPARATOR.'README.md', ''); |
|
160 | + file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'Controller'.DIRECTORY_SEPARATOR.$aOptions['n'].'.php', $sContent); |
|
161 | + mkdir($sDefaultFolder.DIRECTORY_SEPARATOR.'i18n'.DIRECTORY_SEPARATOR.'en_US'.DIRECTORY_SEPARATOR.'LC_MESSAGES', 0777, true); |
|
162 | + file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'meta'.DIRECTORY_SEPARATOR.'LICENSE.md', ''); |
|
163 | + file_put_contents($sDefaultFolder.DIRECTORY_SEPARATOR.'meta'.DIRECTORY_SEPARATOR.'README.md', ''); |
|
164 | 164 | } |
165 | 165 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | * new version with SPL to have the capacity to add external autoload |
16 | 16 | */ |
17 | -spl_autoload_register(function (string $sClassName) |
|
17 | +spl_autoload_register(function(string $sClassName) |
|
18 | 18 | { |
19 | 19 | |
20 | 20 | $sClassName = ltrim($sClassName, '\\'); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $sNamespace = substr($sClassName, 0, $iLastNsPos); |
28 | 28 | $sClassName = substr($sClassName, $iLastNsPos + 1); |
29 | - $sFileName = str_replace('\\', DIRECTORY_SEPARATOR, $sNamespace).DIRECTORY_SEPARATOR; |
|
29 | + $sFileName = str_replace('\\', DIRECTORY_SEPARATOR, $sNamespace).DIRECTORY_SEPARATOR; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $sFileName = str_replace('/', '\\', $sFileName); |
@@ -48,8 +48,7 @@ |
||
48 | 48 | |
49 | 49 | require $sFileClassName; |
50 | 50 | } |
51 | - } |
|
52 | - else { |
|
51 | + } else { |
|
53 | 52 | |
54 | 53 | if (strstr($sFileName, 'Venus\\') && file_exists(preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName))))) { |
55 | 54 |
@@ -17,44 +17,44 @@ discard block |
||
17 | 17 | spl_autoload_register(function (string $sClassName) |
18 | 18 | { |
19 | 19 | |
20 | - $sClassName = ltrim($sClassName, '\\'); |
|
21 | - $sFileName = ''; |
|
22 | - $iLastNsPos = strrpos($sClassName, '\\'); |
|
20 | + $sClassName = ltrim($sClassName, '\\'); |
|
21 | + $sFileName = ''; |
|
22 | + $iLastNsPos = strrpos($sClassName, '\\'); |
|
23 | 23 | |
24 | - if ($iLastNsPos) { |
|
24 | + if ($iLastNsPos) { |
|
25 | 25 | |
26 | - $sNamespace = substr($sClassName, 0, $iLastNsPos); |
|
27 | - $sClassName = substr($sClassName, $iLastNsPos + 1); |
|
26 | + $sNamespace = substr($sClassName, 0, $iLastNsPos); |
|
27 | + $sClassName = substr($sClassName, $iLastNsPos + 1); |
|
28 | 28 | $sFileName = str_replace('\\', DIRECTORY_SEPARATOR, $sNamespace).DIRECTORY_SEPARATOR; |
29 | - } |
|
29 | + } |
|
30 | 30 | |
31 | - $sFileName = str_replace('/', '\\', $sFileName); |
|
31 | + $sFileName = str_replace('/', '\\', $sFileName); |
|
32 | 32 | |
33 | - $sFileName .= $sClassName.'.php'; |
|
33 | + $sFileName .= $sClassName.'.php'; |
|
34 | 34 | |
35 | - if (defined('PORTAL')) { |
|
35 | + if (defined('PORTAL')) { |
|
36 | 36 | |
37 | - $sFileClassName = str_replace(PORTAL, PORTAL.DIRECTORY_SEPARATOR.'app', str_replace(['\\', '/'], DIRECTORY_SEPARATOR, str_replace('conf', DIRECTORY_SEPARATOR, __DIR__).str_replace('Venus\\', '', $sFileName))); |
|
38 | - $sFileClassName = preg_replace('/(tests\\\\[^\\\\]+\\\\)/', '$1app\\', $sFileClassName); |
|
39 | - $sFileClassName = preg_replace('/(src\\\\[^\\\\]+\\\\)/', '$1app\\', $sFileClassName); |
|
40 | - $sFileClassName = str_replace('\\\\', '\\', $sFileClassName); |
|
41 | - $sFileClassName = preg_replace('#bundles//tests/([^/]+)#', 'bundles/tests/$1/app', $sFileClassName); |
|
42 | - $sFileClassName = preg_replace('#bundles//src/([^/]+)#', 'bundles/src/$1/app', $sFileClassName); |
|
43 | - $sFileClassName = str_replace('app\\app', 'app', $sFileClassName); |
|
44 | - $sFileClassName = str_replace('app/app', 'app', $sFileClassName); |
|
37 | + $sFileClassName = str_replace(PORTAL, PORTAL.DIRECTORY_SEPARATOR.'app', str_replace(['\\', '/'], DIRECTORY_SEPARATOR, str_replace('conf', DIRECTORY_SEPARATOR, __DIR__).str_replace('Venus\\', '', $sFileName))); |
|
38 | + $sFileClassName = preg_replace('/(tests\\\\[^\\\\]+\\\\)/', '$1app\\', $sFileClassName); |
|
39 | + $sFileClassName = preg_replace('/(src\\\\[^\\\\]+\\\\)/', '$1app\\', $sFileClassName); |
|
40 | + $sFileClassName = str_replace('\\\\', '\\', $sFileClassName); |
|
41 | + $sFileClassName = preg_replace('#bundles//tests/([^/]+)#', 'bundles/tests/$1/app', $sFileClassName); |
|
42 | + $sFileClassName = preg_replace('#bundles//src/([^/]+)#', 'bundles/src/$1/app', $sFileClassName); |
|
43 | + $sFileClassName = str_replace('app\\app', 'app', $sFileClassName); |
|
44 | + $sFileClassName = str_replace('app/app', 'app', $sFileClassName); |
|
45 | 45 | |
46 | - if (strstr($sFileName, 'Venus\\') && file_exists($sFileClassName)) { |
|
46 | + if (strstr($sFileName, 'Venus\\') && file_exists($sFileClassName)) { |
|
47 | 47 | |
48 | - require $sFileClassName; |
|
49 | - } |
|
50 | - } |
|
51 | - else { |
|
48 | + require $sFileClassName; |
|
49 | + } |
|
50 | + } |
|
51 | + else { |
|
52 | 52 | |
53 | - if (strstr($sFileName, 'Venus\\') && file_exists(preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName))))) { |
|
53 | + if (strstr($sFileName, 'Venus\\') && file_exists(preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName))))) { |
|
54 | 54 | |
55 | - require preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName))); |
|
56 | - } |
|
57 | - } |
|
55 | + require preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName))); |
|
56 | + } |
|
57 | + } |
|
58 | 58 | }); |
59 | 59 | |
60 | 60 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | if (file_exists(preg_replace('#bundles[/\\\\]conf#', '', __DIR__).'vendor/autoload.php')) { |
65 | 65 | |
66 | - include preg_replace('#bundles[/\\\\]conf#', '', __DIR__).'vendor/autoload.php'; |
|
66 | + include preg_replace('#bundles[/\\\\]conf#', '', __DIR__).'vendor/autoload.php'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | |
75 | 75 | if (isset($oConfig) && isset($oConfig->autoload)) { |
76 | 76 | |
77 | - $oAutoloadConf = $oConfig->autoload; |
|
77 | + $oAutoloadConf = $oConfig->autoload; |
|
78 | 78 | |
79 | - foreach ($oAutoloadConf as $sFile) { |
|
79 | + foreach ($oAutoloadConf as $sFile) { |
|
80 | 80 | |
81 | - require __DIR__.'/../'.$sFile; |
|
82 | - } |
|
81 | + require __DIR__.'/../'.$sFile; |
|
82 | + } |
|
83 | 83 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * @param int $iTimeout expiration of cache |
62 | 62 | * @return mixed |
63 | 63 | */ |
64 | - public function get(string $sName, int &$iFlags = null, int $iTimeout = 0) |
|
64 | + public function get(string $sName, int&$iFlags = null, int $iTimeout = 0) |
|
65 | 65 | { |
66 | 66 | return parent::get($sName); |
67 | 67 | } |
@@ -9,11 +9,11 @@ |
||
9 | 9 | |
10 | 10 | interface RequestInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * get parameter |
|
14 | - * @param string $name |
|
15 | - * @param string $default |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - public function get(string $name, string $default = null) : string; |
|
12 | + /** |
|
13 | + * get parameter |
|
14 | + * @param string $name |
|
15 | + * @param string $default |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + public function get(string $name, string $default = null) : string; |
|
19 | 19 | } |
@@ -9,19 +9,19 @@ |
||
9 | 9 | |
10 | 10 | class Files implements RequestInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * get parameter |
|
14 | - * @param string $name |
|
15 | - * @param string $default |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - public function get(string $name, string $default = null) : string |
|
19 | - { |
|
20 | - if (isset($_FILES[$name]) && $_FILES[$name] != '') { |
|
21 | - return $_FILES[$name]; |
|
22 | - } |
|
23 | - else if ($default !== null) { |
|
24 | - return $default; |
|
25 | - } |
|
26 | - } |
|
12 | + /** |
|
13 | + * get parameter |
|
14 | + * @param string $name |
|
15 | + * @param string $default |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + public function get(string $name, string $default = null) : string |
|
19 | + { |
|
20 | + if (isset($_FILES[$name]) && $_FILES[$name] != '') { |
|
21 | + return $_FILES[$name]; |
|
22 | + } |
|
23 | + else if ($default !== null) { |
|
24 | + return $default; |
|
25 | + } |
|
26 | + } |
|
27 | 27 | } |
@@ -19,8 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | if (isset($_COOKIE[$name]) && $_COOKIE[$name] != '') { |
21 | 21 | return $_COOKIE[$name]; |
22 | - } |
|
23 | - else if ($default !== null) { |
|
22 | + } else if ($default !== null) { |
|
24 | 23 | return $default; |
25 | 24 | } |
26 | 25 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | if ( is_object($mObject)) { |
39 | 39 | |
40 | - $mObject = (array) $mObject; |
|
40 | + $mObject = (array) $mObject; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function object_to_array($mObject) : array |
37 | 37 | { |
38 | - if ( is_object($mObject)) { |
|
38 | + if (is_object($mObject)) { |
|
39 | 39 | |
40 | - $mObject = (array) $mObject; |
|
40 | + $mObject = (array)$mObject; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $aNew = array(); |
47 | 47 | |
48 | - foreach($mObject as $sKey => $mValues) { |
|
48 | + foreach ($mObject as $sKey => $mValues) { |
|
49 | 49 | |
50 | 50 | $sKey = preg_replace("/^\\0(.*)\\0/", "", $sKey); |
51 | 51 | $aNew[$sKey] = self::object_to_array($mValues); |
@@ -50,8 +50,7 @@ |
||
50 | 50 | $sKey = preg_replace("/^\\0(.*)\\0/", "", $sKey); |
51 | 51 | $aNew[$sKey] = self::object_to_array($mValues); |
52 | 52 | } |
53 | - } |
|
54 | - else { |
|
53 | + } else { |
|
55 | 54 | |
56 | 55 | $aNew = $mObject; |
57 | 56 | } |
@@ -7,12 +7,12 @@ |
||
7 | 7 | */ |
8 | 8 | class LogLevel |
9 | 9 | { |
10 | - const EMERGENCY = 'emergency'; |
|
11 | - const ALERT = 'alert'; |
|
12 | - const CRITICAL = 'critical'; |
|
13 | - const ERROR = 'error'; |
|
14 | - const WARNING = 'warning'; |
|
15 | - const NOTICE = 'notice'; |
|
16 | - const INFO = 'info'; |
|
17 | - const DEBUG = 'debug'; |
|
10 | + const EMERGENCY = 'emergency'; |
|
11 | + const ALERT = 'alert'; |
|
12 | + const CRITICAL = 'critical'; |
|
13 | + const ERROR = 'error'; |
|
14 | + const WARNING = 'warning'; |
|
15 | + const NOTICE = 'notice'; |
|
16 | + const INFO = 'info'; |
|
17 | + const DEBUG = 'debug'; |
|
18 | 18 | } |