@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | $this->instance = new $className(); |
45 | 45 | } catch (Exception $ex) { |
46 | 46 | $this->writeToStderr("System Fail to Start: \n"); |
47 | - $this->writeToStderr('Message: ' . $ex->getMessage() . "\n"); |
|
48 | - $this->writeToStderr("Stack Trace:\n" . $ex->getTraceAsString()); |
|
47 | + $this->writeToStderr('Message: '.$ex->getMessage()."\n"); |
|
48 | + $this->writeToStderr("Stack Trace:\n".$ex->getTraceAsString()); |
|
49 | 49 | $this->writeToStderr("\n\n"); |
50 | 50 | } |
51 | 51 | } |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | if (empty($logname)) { |
60 | - $logname = str_replace("\\", "_", strtolower($this->className)) . "." . strtolower($this->methodName); |
|
60 | + $logname = str_replace("\\", "_", strtolower($this->className)).".".strtolower($this->methodName); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | if ( |
64 | - is_writable(self::BASE_LOG_PATH . '/' . $logname . '.log') |
|
65 | - && is_writable(self::BASE_LOG_PATH . '/' . $logname . '.error.log') |
|
64 | + is_writable(self::BASE_LOG_PATH.'/'.$logname.'.log') |
|
65 | + && is_writable(self::BASE_LOG_PATH.'/'.$logname.'.error.log') |
|
66 | 66 | ) { |
67 | 67 | fclose(STDIN); |
68 | 68 | fclose(STDOUT); |
69 | 69 | fclose(STDERR); |
70 | 70 | $this->stdIn = fopen('/dev/null', 'r'); |
71 | - $this->stdOut = fopen(self::BASE_LOG_PATH . '/' . $logname . '.log', 'ab'); |
|
72 | - $this->stdErr = fopen(self::BASE_LOG_PATH . '/' . $logname . '.error.log', 'ab'); |
|
71 | + $this->stdOut = fopen(self::BASE_LOG_PATH.'/'.$logname.'.log', 'ab'); |
|
72 | + $this->stdErr = fopen(self::BASE_LOG_PATH.'/'.$logname.'.error.log', 'ab'); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $instance = $this->instance; |
92 | 92 | $method = $this->methodName; |
93 | 93 | |
94 | - $this->writeToStdout("Service " . $this->className . "::" . $this->methodName . " started at " . date('c') . "\n"); |
|
94 | + $this->writeToStdout("Service ".$this->className."::".$this->methodName." started at ".date('c')."\n"); |
|
95 | 95 | |
96 | 96 | $continue = true; |
97 | 97 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | $this->writeToStdout($output); |
104 | 104 | } |
105 | 105 | } catch (Exception $ex) { |
106 | - $this->writeToStderr(date('c') . ' [' . get_class($ex) . '] in ' . $ex->getFile() . ' at line ' . $ex->getLine() . ' -- ' . "\n"); |
|
107 | - $this->writeToStderr('Message: ' . $ex->getMessage() . "\n"); |
|
108 | - $this->writeToStderr("Stack Trace:\n" . $ex->getTraceAsString()); |
|
106 | + $this->writeToStderr(date('c').' ['.get_class($ex).'] in '.$ex->getFile().' at line '.$ex->getLine().' -- '."\n"); |
|
107 | + $this->writeToStderr('Message: '.$ex->getMessage()."\n"); |
|
108 | + $this->writeToStderr("Stack Trace:\n".$ex->getTraceAsString()); |
|
109 | 109 | $this->writeToStderr("\n\n"); |
110 | 110 | } |
111 | 111 |
@@ -27,33 +27,33 @@ 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 | - $consoleArgsPrepared = '[ "' . implode('", "', $consoleArgs) . '" ]'; |
|
50 | + $consoleArgsPrepared = '[ "'.implode('", "', $consoleArgs).'" ]'; |
|
51 | 51 | } else { |
52 | 52 | $consoleArgsPrepared = "[ ]"; |
53 | 53 | } |
54 | 54 | |
55 | - $serviceTemplatePath = __DIR__ . "/../template/_service.php.tpl"; |
|
56 | - $daemonizeService = __DIR__ . "/../services/$svcName.php"; |
|
55 | + $serviceTemplatePath = __DIR__."/../template/_service.php.tpl"; |
|
56 | + $daemonizeService = __DIR__."/../services/$svcName.php"; |
|
57 | 57 | $phpPath = PHP_BINARY; |
58 | 58 | |
59 | 59 | $vars = [ |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | require_once ($vars['#BOOTSTRAP#']); |
78 | 78 | $classParts = explode('::', str_replace("\\\\", "\\", $vars['#CLASS#'])); |
79 | 79 | if (!class_exists($classParts[0])) { |
80 | - throw new \Exception('Could not find class ' . $classParts[0]); |
|
80 | + throw new \Exception('Could not find class '.$classParts[0]); |
|
81 | 81 | } |
82 | 82 | $className = $classParts[0]; |
83 | 83 | $classTest = new $className(); |
84 | 84 | if (!method_exists($classTest, $classParts[1])) { |
85 | - throw new \Exception('Could not find method ' . $vars['#CLASS#']); |
|
85 | + throw new \Exception('Could not find method '.$vars['#CLASS#']); |
|
86 | 86 | } |
87 | 87 | |
88 | - set_error_handler(function ($number, $error) { |
|
88 | + set_error_handler(function($number, $error) { |
|
89 | 89 | throw new \Exception($error); |
90 | 90 | }); |
91 | 91 | file_put_contents($targetServicePath, $templateStr); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | protected static function isDaemonizeService($filename) |
135 | 135 | { |
136 | - set_error_handler(function ($number, $error) { |
|
136 | + set_error_handler(function($number, $error) { |
|
137 | 137 | throw new \Exception($error); |
138 | 138 | }); |
139 | 139 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'rootdir', |
31 | 31 | InputArgument::OPTIONAL, |
32 | 32 | 'The root path where your application is installed', |
33 | - getcwd() . "/" |
|
33 | + getcwd()."/" |
|
34 | 34 | ) |
35 | 35 | ->addArgument( |
36 | 36 | 'args', |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $bootstrap = $input->getArgument('bootstrap'); |
46 | 46 | $rootPath = $input->getArgument('rootdir'); |
47 | 47 | |
48 | - $realPathBootstrap = realpath($rootPath . $bootstrap); |
|
48 | + $realPathBootstrap = realpath($rootPath.$bootstrap); |
|
49 | 49 | $realPathRootPath = realpath($rootPath); |
50 | 50 | |
51 | 51 | if (!file_exists($realPathRootPath)) { |
@@ -43,7 +43,7 @@ |
||
43 | 43 | 'rootdir', |
44 | 44 | InputArgument::OPTIONAL, |
45 | 45 | 'The root path where your application is installed', |
46 | - getcwd() . "/" |
|
46 | + getcwd()."/" |
|
47 | 47 | ) |
48 | 48 | ->addArgument( |
49 | 49 | 'description', |