@@ -99,6 +99,9 @@ |
||
99 | 99 | return true; |
100 | 100 | } |
101 | 101 | |
102 | + /** |
|
103 | + * @param string $text |
|
104 | + */ |
|
102 | 105 | protected static function replaceVars($vars, $text) |
103 | 106 | { |
104 | 107 | foreach ($vars as $searchFor=>$replace) { |
@@ -27,36 +27,36 @@ discard block |
||
27 | 27 | } |
28 | 28 | $targetServicePath = $targetPathAvailable[$template]; |
29 | 29 | |
30 | - $templatePath = __DIR__ . "/../template/linux-" . $template . "-service.tpl"; |
|
30 | + $templatePath = __DIR__."/../template/linux-".$template."-service.tpl"; |
|
31 | 31 | |
32 | 32 | if (!file_exists($templatePath)) { |
33 | 33 | throw new \Exception("Template '$templatePath' not found"); |
34 | 34 | } |
35 | 35 | |
36 | - $bootstrap = $curdir . '/' . $bootstrap; |
|
36 | + $bootstrap = $curdir.'/'.$bootstrap; |
|
37 | 37 | if (!file_exists($bootstrap)) { |
38 | 38 | throw new \Exception("Bootstrap '$bootstrap' not found"); |
39 | 39 | } |
40 | 40 | |
41 | - $autoload = realpath(__DIR__ . "/../vendor/autoload.php"); |
|
41 | + $autoload = realpath(__DIR__."/../vendor/autoload.php"); |
|
42 | 42 | if (!file_exists($autoload)) { |
43 | - $autoload = realpath(__DIR__ . "/../../../autoload.php"); |
|
43 | + $autoload = realpath(__DIR__."/../../../autoload.php"); |
|
44 | 44 | if (!file_exists($autoload)) { |
45 | 45 | throw new \Exception('Daemonize autoload not found. Did you run `composer dump-autload`?'); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | 49 | if (!empty($consoleArgs)) { |
50 | - for ($i=0; $i<count($consoleArgs); $i++) { |
|
50 | + for ($i = 0; $i < count($consoleArgs); $i++) { |
|
51 | 51 | $consoleArgs[$i] = str_replace('"', '\\"', $consoleArgs[$i]); |
52 | 52 | } |
53 | - $consoleArgsPrepared = '[ "' . implode('", "', $consoleArgs) . '" ]'; |
|
53 | + $consoleArgsPrepared = '[ "'.implode('", "', $consoleArgs).'" ]'; |
|
54 | 54 | } else { |
55 | 55 | $consoleArgsPrepared = "[ ]"; |
56 | 56 | } |
57 | 57 | |
58 | - $serviceTemplatePath = __DIR__ . "/../template/_service.php.tpl"; |
|
59 | - $daemonizeService = __DIR__ . "/../services/$svcName.php"; |
|
58 | + $serviceTemplatePath = __DIR__."/../template/_service.php.tpl"; |
|
59 | + $daemonizeService = __DIR__."/../services/$svcName.php"; |
|
60 | 60 | $phpPath = PHP_BINARY; |
61 | 61 | |
62 | 62 | $vars = [ |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | require_once ($vars['#BOOTSTRAP#']); |
81 | 81 | $classParts = explode('::', str_replace("\\\\", "\\", $vars['#CLASS#'])); |
82 | 82 | if (!class_exists($classParts[0])) { |
83 | - throw new \Exception('Could not find class ' . $classParts[0]); |
|
83 | + throw new \Exception('Could not find class '.$classParts[0]); |
|
84 | 84 | } |
85 | 85 | $className = $classParts[0]; |
86 | 86 | $classTest = new $className(); |
87 | 87 | if (!method_exists($classTest, $classParts[1])) { |
88 | - throw new \Exception('Could not find method ' . $vars['#CLASS#']); |
|
88 | + throw new \Exception('Could not find method '.$vars['#CLASS#']); |
|
89 | 89 | } |
90 | 90 | |
91 | - set_error_handler(function ($number, $error) { |
|
91 | + set_error_handler(function($number, $error) { |
|
92 | 92 | throw new \Exception($error); |
93 | 93 | }); |
94 | 94 | file_put_contents($targetServicePath, $templateStr); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | protected static function isDaemonizeService($filename) |
137 | 137 | { |
138 | - set_error_handler(function ($number, $error) { |
|
138 | + set_error_handler(function($number, $error) { |
|
139 | 139 | throw new \Exception($error); |
140 | 140 | }); |
141 | 141 |