@@ -18,5 +18,5 @@ |
||
18 | 18 | * @param Container 依存コンテナ |
19 | 19 | * @param ReflectionMethod リフレクションメソッドオブジェクト |
20 | 20 | */ |
21 | - public function onMethodInject(IAnnotatable &$instance, Container $container, \ReflectionMethod $method); |
|
21 | + public function onMethodInject(IAnnotatable&$instance, Container $container, \ReflectionMethod $method); |
|
22 | 22 | } |
@@ -183,6 +183,7 @@ |
||
183 | 183 | /** |
184 | 184 | * ログローテートサイクルを時間に変換 |
185 | 185 | * @param string ローテートサイクル |
186 | + * @param string $cycle |
|
186 | 187 | * @return int ローテート時間 |
187 | 188 | */ |
188 | 189 | private function cycle2value($cycle) |
@@ -68,11 +68,11 @@ |
||
68 | 68 | public function load() |
69 | 69 | { |
70 | 70 | $this->loadLogLevel() |
71 | - ->loadLogFilePath() |
|
72 | - ->loadRotateCycle() |
|
73 | - ->loadRotateSize() |
|
74 | - ->loadApplicationName() |
|
75 | - ->loadFormat(); |
|
71 | + ->loadLogFilePath() |
|
72 | + ->loadRotateCycle() |
|
73 | + ->loadRotateSize() |
|
74 | + ->loadApplicationName() |
|
75 | + ->loadFormat(); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } else { |
47 | 47 | $configMap = $this->parseConfig($config); |
48 | 48 | if ($configMap === null) { |
49 | - throw new LoggerException("Log config file does not exist: " . $config); |
|
49 | + throw new LoggerException("Log config file does not exist: ".$config); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | $this->ioContainer = new Container(); |
55 | 55 | |
56 | 56 | $rootDir = $this->getApplicationRoot(); |
57 | - $this->ioContainer->file = function () use ($rootDir, $configMap) { |
|
57 | + $this->ioContainer->file = function() use ($rootDir, $configMap) { |
|
58 | 58 | if (!array_key_exists("path", $configMap)) { |
59 | 59 | throw new LoggerException("Log path must be defined."); |
60 | 60 | } |
61 | - return new File($rootDir . "/" . $configMap["path"]); |
|
61 | + return new File($rootDir."/".$configMap["path"]); |
|
62 | 62 | }; |
63 | - $this->ioContainer->fileWriter = function () use ($rootDir, $configMap) { |
|
64 | - return new SimpleFileWriter($rootDir . "/" . $configMap["path"]); |
|
63 | + $this->ioContainer->fileWriter = function() use ($rootDir, $configMap) { |
|
64 | + return new SimpleFileWriter($rootDir."/".$configMap["path"]); |
|
65 | 65 | }; |
66 | 66 | |
67 | 67 | $this->configMap = $configMap; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->logContainer->logPath = $file->getFilePath(); |
121 | - $this->logContainer->statusPath = preg_replace_callback('/(.*)\..+/', function ($matches) { |
|
121 | + $this->logContainer->statusPath = preg_replace_callback('/(.*)\..+/', function($matches) { |
|
122 | 122 | return "$matches[1].status"; |
123 | 123 | }, $this->logContainer->logPath); |
124 | 124 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $rotateSize = intval($this->configMap["rotate_size"]); |
149 | 149 | // ローテートサイズが不正の場合(正の整数以外の値が設定された場合) |
150 | 150 | if ($rotateSize <= 0) { |
151 | - throw new LoggerException("Invalid log rotate size: " . $this->configMap["rotate_size"]); |
|
151 | + throw new LoggerException("Invalid log rotate size: ".$this->configMap["rotate_size"]); |
|
152 | 152 | } |
153 | 153 | $this->logContainer->rotateSize = $rotateSize; |
154 | 154 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | case 'year': |
211 | 211 | return $year_to_h; |
212 | 212 | default: |
213 | - throw new LoggerException("Invalid log rotate cycle: " . $cycle); |
|
213 | + throw new LoggerException("Invalid log rotate cycle: ".$cycle); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * フォーマット済みメッセージを返却する |
36 | 36 | * @param string メッセージ |
37 | 37 | * @param string ログレベル |
38 | - * @return フォーマット済みメッセージ |
|
38 | + * @return string |
|
39 | 39 | */ |
40 | 40 | public function getFormattedMessage($message, $logLevel) |
41 | 41 | { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | // メッセージ |
50 | 50 | $formattedMessage = preg_replace('/%m/', $message, $formattedMessage); |
51 | 51 | |
52 | - return $formattedMessage . PHP_EOL; |
|
52 | + return $formattedMessage.PHP_EOL; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -32,7 +32,7 @@ |
||
32 | 32 | { |
33 | 33 | $sapi = php_sapi_name(); |
34 | 34 | if (array_key_exists($sapi, $this->sapis) && $this->sapis[$sapi] === 'http') { |
35 | - echo $text . "<br>"; |
|
35 | + echo $text."<br>"; |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | /** |
87 | 87 | * インスタンスを返却する |
88 | - * @return WebStream\Module\Logger ロガーインスタンス |
|
88 | + * @return Logger ロガーインスタンス |
|
89 | 89 | */ |
90 | 90 | public static function getInstance() |
91 | 91 | { |
@@ -171,6 +171,8 @@ discard block |
||
171 | 171 | * @param string ログレベル文字列 |
172 | 172 | * @param string 出力文字列 |
173 | 173 | * @param array<mixed> 埋め込み値リスト |
174 | + * @param integer $level |
|
175 | + * @param string $msg |
|
174 | 176 | */ |
175 | 177 | public function write($level, $msg, $context = null) |
176 | 178 | { |
@@ -267,6 +269,8 @@ discard block |
||
267 | 269 | * ローテートを実行する |
268 | 270 | * @param integer 作成日時のUnixTime |
269 | 271 | * @param integer 現在日時のUnixTime |
272 | + * @param integer $from |
|
273 | + * @param integer $to |
|
270 | 274 | */ |
271 | 275 | private function runRotate($from, $to) |
272 | 276 | { |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | |
76 | 76 | $this->ioContainer = new Container(); |
77 | 77 | |
78 | - $this->ioContainer->statusReader = function () use ($statusFile) { |
|
78 | + $this->ioContainer->statusReader = function() use ($statusFile) { |
|
79 | 79 | return new FileReader($statusFile); |
80 | 80 | }; |
81 | - $this->ioContainer->statusWriter = function () use ($statusFile) { |
|
81 | + $this->ioContainer->statusWriter = function() use ($statusFile) { |
|
82 | 82 | return new SimpleFileWriter($statusFile->getFilePath()); |
83 | 83 | }; |
84 | - $this->ioContainer->logWriter = function () use ($logFile) { |
|
84 | + $this->ioContainer->logWriter = function() use ($logFile) { |
|
85 | 85 | return new SimpleFileWriter($logFile->getFilePath()); |
86 | 86 | }; |
87 | 87 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | date_default_timezone_set('Asia/Tokyo'); |
203 | 203 | $msec = sprintf("%2d", floatval(microtime()) * 100); |
204 | 204 | |
205 | - return strftime("%Y-%m-%d %H:%M:%S") . "," . $msec; |
|
205 | + return strftime("%Y-%m-%d %H:%M:%S").",".$msec; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $outputter->write(self::$formatter->getFormattedMessage($msg, $level)); |
241 | 241 | } |
242 | 242 | } else { |
243 | - $this->ioContainer->logWriter->write(self::$formatter->getFormattedMessage($msg, $level) . PHP_EOL); |
|
243 | + $this->ioContainer->logWriter->write(self::$formatter->getFormattedMessage($msg, $level).PHP_EOL); |
|
244 | 244 | } |
245 | 245 | } catch (LoggerException $e) { |
246 | 246 | throw $e; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | { |
288 | 288 | $content = $this->ioContainer->statusReader->read(); |
289 | 289 | if (!preg_match('/^\d{10}$/', $content)) { |
290 | - throw new LoggerException("Invalid log state file contents: " . $content); |
|
290 | + throw new LoggerException("Invalid log state file contents: ".$content); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | return intval($content); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function defaultLoggerFormatter() |
20 | 20 | { |
21 | - return '[%d{' . $this->defaultDateTimeFormatter() . '.%f}][%5L] %m'; |
|
21 | + return '[%d{'.$this->defaultDateTimeFormatter().'.%f}][%5L] %m'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | continue; |
46 | 46 | } |
47 | 47 | $msg .= PHP_EOL; |
48 | - $msg .= "\t#" . trim($stacktraceLine); |
|
48 | + $msg .= "\t#".trim($stacktraceLine); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $msg; |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | /** |
32 | 32 | * constructor |
33 | - * @param string $filepath ファイルパス |
|
33 | + * @param string $filePath ファイルパス |
|
34 | 34 | */ |
35 | 35 | public function __construct(stirng $filePath) |
36 | 36 | { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | while (@is_link($filePath)) { |
85 | 85 | $linkPath = readlink($filePath); |
86 | 86 | if ($linkPath === false) { |
87 | - throw new IOException("Symbolic link read error: " . $filePath); |
|
87 | + throw new IOException("Symbolic link read error: ".$filePath); |
|
88 | 88 | } |
89 | 89 | $filePath = $linkPath; |
90 | 90 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $length = filesize($filePath); |
180 | 180 | |
181 | 181 | if ($length === false) { |
182 | - throw new IOException("Cannot get filesize of " . $filePath); |
|
182 | + throw new IOException("Cannot get filesize of ".$filePath); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | $dirname = dirname($destPath); |
230 | 230 | $dir = new File($dirname); |
231 | 231 | if (!$dir->isWritable()) { |
232 | - throw new IOException("Cannot writable: " . $destPath); |
|
232 | + throw new IOException("Cannot writable: ".$destPath); |
|
233 | 233 | } |
234 | 234 | $dirPath = $dir->getFilePath(); |
235 | - $absDestPath = $dirPath . "/" . basename($destPath); |
|
235 | + $absDestPath = $dirPath."/".basename($destPath); |
|
236 | 236 | |
237 | 237 | return rename($this->filePath, $absDestPath); |
238 | 238 | } |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | } else if (is_string($file)) { |
31 | 31 | $this->file = new File($file); |
32 | 32 | } else { |
33 | - throw new InvalidArgumentException("Unable to open file: " . $file); |
|
33 | + throw new InvalidArgumentException("Unable to open file: ".$file); |
|
34 | 34 | } |
35 | 35 | $stream = @fopen($this->file->getAbsoluteFilePath(), 'r'); |
36 | 36 | if (!is_resource($stream) || $stream === false) { |
37 | - throw new IOException("Unable open " . $this->file->getAbsoluteFilePath()); |
|
37 | + throw new IOException("Unable open ".$this->file->getAbsoluteFilePath()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | parent::__construct($stream); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function reset() |
134 | 134 | { |
135 | 135 | if (!$this->isMarkSupported()) { |
136 | - throw new IOException(get_class($this) . " does not support mark and reset."); |
|
136 | + throw new IOException(get_class($this)." does not support mark and reset."); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | // ポインタ位置をmark位置に移動 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function mark() |
84 | 84 | { |
85 | 85 | if (!$this->isMarkSupported()) { |
86 | - throw new IOException(get_class($this) . " does not support mark."); |
|
86 | + throw new IOException(get_class($this)." does not support mark."); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $this->markedPosition = $this->cursorPosition; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function reset() |
97 | 97 | { |
98 | 98 | if (!$this->isMarkSupported()) { |
99 | - throw new IOException(get_class($this) . " does not support mark and reset."); |
|
99 | + throw new IOException(get_class($this)." does not support mark and reset."); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | // mark位置を初期値に戻す |