@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$autoload = __DIR__ . "/../vendor/autoload.php"; |
|
3 | +$autoload = __DIR__."/../vendor/autoload.php"; |
|
4 | 4 | if (!file_exists($autoload)) { |
5 | - $autoload = __DIR__ . "/../../../../autoload.php"; |
|
5 | + $autoload = __DIR__."/../../../../autoload.php"; |
|
6 | 6 | if (!file_exists($autoload)) { |
7 | 7 | throw new \Exception('Autoload not found. Did you run `composer dump-autload`?'); |
8 | 8 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | } else { |
27 | 27 | $output->writeln("List of daemonize services: "); |
28 | 28 | foreach ($list as $filename) { |
29 | - $output->writeln(" - " . basename($filename)); |
|
29 | + $output->writeln(" - ".basename($filename)); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | $output->writeln(""); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | { |
55 | 55 | $className = $input->getArgument('classname'); |
56 | 56 | $rootPath = $input->getOption('rootdir'); |
57 | - $bootstrap = $rootPath . "/" . $input->getOption('bootstrap'); |
|
57 | + $bootstrap = $rootPath."/".$input->getOption('bootstrap'); |
|
58 | 58 | |
59 | 59 | if (!file_exists($rootPath)) { |
60 | 60 | throw new \Exception("The rootpath '$bootstrap' does not exists. Use absolute path or relative path from current directory."); |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | protected function writeFile($path, $contents) |
15 | 15 | { |
16 | 16 | if (!is_null($this->overridePath)) { |
17 | - $path = $this->overridePath . '/' . basename($path); |
|
17 | + $path = $this->overridePath.'/'.basename($path); |
|
18 | 18 | } |
19 | 19 | |
20 | - set_error_handler(function ($number, $error) { |
|
20 | + set_error_handler(function($number, $error) { |
|
21 | 21 | throw new DaemonizeException($error); |
22 | 22 | }); |
23 | 23 | if (is_null($this->overridePath)) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $contents = ""; |
44 | 44 | if (!empty($environment)) { |
45 | - $contents = "export " . http_build_query($environment, "", "\nexport "); |
|
45 | + $contents = "export ".http_build_query($environment, "", "\nexport "); |
|
46 | 46 | } |
47 | 47 | $this->writeFile($path, $contents); |
48 | 48 | } |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | $targetServicePath = $targetPathAvailable[$template]; |
49 | - $templatePath = __DIR__ . "/../template/linux-" . $template . "-service.tpl"; |
|
49 | + $templatePath = __DIR__."/../template/linux-".$template."-service.tpl"; |
|
50 | 50 | |
51 | 51 | if (!file_exists($templatePath)) { |
52 | 52 | throw new \Exception("Template '$templatePath' not found"); |
53 | 53 | } |
54 | 54 | |
55 | 55 | if (!file_exists(realpath($curdir)) && $check) { |
56 | - throw new \Exception("RootPath '" . $curdir . "' not found. Use an absolute path. e.g. /projects/example"); |
|
56 | + throw new \Exception("RootPath '".$curdir."' not found. Use an absolute path. e.g. /projects/example"); |
|
57 | 57 | } |
58 | 58 | |
59 | - if (!file_exists($curdir . '/' . $bootstrap) && $check) { |
|
59 | + if (!file_exists($curdir.'/'.$bootstrap) && $check) { |
|
60 | 60 | throw new \Exception("Bootstrap '$bootstrap' not found. Use a relative path from root directory. e.g. vendor/autoload.php"); |
61 | 61 | } |
62 | 62 | |
63 | - $autoload = realpath(__DIR__ . "/../vendor/autoload.php"); |
|
63 | + $autoload = realpath(__DIR__."/../vendor/autoload.php"); |
|
64 | 64 | if (!file_exists($autoload)) { |
65 | - $autoload = realpath(__DIR__ . "/../../../autoload.php"); |
|
65 | + $autoload = realpath(__DIR__."/../../../autoload.php"); |
|
66 | 66 | if (!file_exists($autoload) && $check) { |
67 | 67 | throw new \Exception('Daemonize autoload not found. Did you run `composer dump-autload`?'); |
68 | 68 | } |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | |
71 | 71 | $consoleArgsPrepared = ''; |
72 | 72 | if (!empty($consoleArgs)) { |
73 | - $consoleArgsPrepared = '--http-get ' . http_build_query($consoleArgs, '', ' --http-get '); |
|
73 | + $consoleArgsPrepared = '--http-get '.http_build_query($consoleArgs, '', ' --http-get '); |
|
74 | 74 | } |
75 | 75 | |
76 | - $environmentPrepared = '/etc/daemonize/' . $svcName . '.env'; |
|
76 | + $environmentPrepared = '/etc/daemonize/'.$svcName.'.env'; |
|
77 | 77 | |
78 | - $serviceTemplatePath = __DIR__ . "/../template/_service.php.tpl"; |
|
79 | - $daemonizeService = realpath(__DIR__ . "/../scripts/daemonize"); |
|
78 | + $serviceTemplatePath = __DIR__."/../template/_service.php.tpl"; |
|
79 | + $daemonizeService = realpath(__DIR__."/../scripts/daemonize"); |
|
80 | 80 | |
81 | 81 | $vars = [ |
82 | 82 | '#DESCRIPTION#' => $description, |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | "#ENVCMDLINE#" => implode( |
94 | 94 | ' ', |
95 | 95 | array_map( |
96 | - function ($v, $k) { |
|
96 | + function($v, $k) { |
|
97 | 97 | return "$k=\"$v\""; |
98 | 98 | }, |
99 | 99 | $environment, |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | require_once($vars['#BOOTSTRAP#']); |
110 | 110 | $classParts = explode('::', str_replace("\\\\", "\\", $vars['#CLASS#'])); |
111 | 111 | if (!class_exists($classParts[0])) { |
112 | - throw new \Exception('Could not find class ' . $classParts[0]); |
|
112 | + throw new \Exception('Could not find class '.$classParts[0]); |
|
113 | 113 | } |
114 | 114 | $className = $classParts[0]; |
115 | 115 | $classTest = new $className(); |
116 | 116 | if (!method_exists($classTest, $classParts[1])) { |
117 | - throw new \Exception('Could not find method ' . $vars['#CLASS#']); |
|
117 | + throw new \Exception('Could not find method '.$vars['#CLASS#']); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | "/etc/init.d/$svcName", |
139 | 139 | "/etc/init/$svcName.conf", |
140 | 140 | "/etc/systemd/system/$svcName.service", |
141 | - '/etc/daemonize/' . $svcName . '.env', |
|
142 | - '/etc/cron.d/' . $svcName, |
|
141 | + '/etc/daemonize/'.$svcName.'.env', |
|
142 | + '/etc/cron.d/'.$svcName, |
|
143 | 143 | ]; |
144 | 144 | |
145 | 145 | $found = false; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | protected static function isDaemonizeService($filename) |
164 | 164 | { |
165 | - set_error_handler(function ($number, $error) { |
|
165 | + set_error_handler(function($number, $error) { |
|
166 | 166 | throw new \Exception($error); |
167 | 167 | }); |
168 | 168 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | foreach ($list as $svcType => $filenames) { |
188 | 188 | foreach ($filenames as $filename) { |
189 | 189 | if (self::isDaemonizeService($filename)) { |
190 | - $return[] = $svcType . ": " . |
|
190 | + $return[] = $svcType.": ". |
|
191 | 191 | str_replace( |
192 | 192 | '.service', |
193 | 193 | '', |
@@ -11,22 +11,22 @@ |
||
11 | 11 | { |
12 | 12 | public function process() |
13 | 13 | { |
14 | - file_put_contents(sys_get_temp_dir() . '/tryme.txt', date('c') . "\n", FILE_APPEND); |
|
15 | - file_put_contents(sys_get_temp_dir() . '/tryme.txt', print_r($_REQUEST, true), FILE_APPEND); |
|
16 | - file_put_contents(sys_get_temp_dir() . '/tryme.txt', print_r(getenv('TEST'), true), FILE_APPEND); |
|
14 | + file_put_contents(sys_get_temp_dir().'/tryme.txt', date('c')."\n", FILE_APPEND); |
|
15 | + file_put_contents(sys_get_temp_dir().'/tryme.txt', print_r($_REQUEST, true), FILE_APPEND); |
|
16 | + file_put_contents(sys_get_temp_dir().'/tryme.txt', print_r(getenv('TEST'), true), FILE_APPEND); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function ping($arg1, $arg2 = null) |
20 | 20 | { |
21 | 21 | $result = "pong - $arg1 - $arg2\n"; |
22 | 22 | echo $result; |
23 | - file_put_contents(sys_get_temp_dir() . '/tryme_test.txt', "$result", FILE_APPEND); |
|
23 | + file_put_contents(sys_get_temp_dir().'/tryme_test.txt', "$result", FILE_APPEND); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function saveJson() |
27 | 27 | { |
28 | - file_put_contents('/tmp/tryme_test.txt', $_SERVER['QUERY_STRING'] . "\n"); |
|
29 | - file_put_contents('/tmp/tryme_test.txt', json_encode($_REQUEST) . "\n", FILE_APPEND); |
|
28 | + file_put_contents('/tmp/tryme_test.txt', $_SERVER['QUERY_STRING']."\n"); |
|
29 | + file_put_contents('/tmp/tryme_test.txt', json_encode($_REQUEST)."\n", FILE_APPEND); |
|
30 | 30 | file_put_contents('/tmp/tryme_test.txt', json_encode($_REQUEST), FILE_APPEND); |
31 | 31 | } |
32 | 32 | } |