@@ -209,6 +209,8 @@ discard block |
||
| 209 | 209 | * @param string ログレベル文字列 |
| 210 | 210 | * @param string 出力文字列 |
| 211 | 211 | * @param array<mixed> 埋め込み値リスト |
| 212 | + * @param integer $level |
|
| 213 | + * @param string $msg |
|
| 212 | 214 | */ |
| 213 | 215 | public function write($level, $msg, $context = null) |
| 214 | 216 | { |
@@ -305,6 +307,8 @@ discard block |
||
| 305 | 307 | * ローテートを実行する |
| 306 | 308 | * @param integer 作成日時のUnixTime |
| 307 | 309 | * @param integer 現在日時のUnixTime |
| 310 | + * @param integer $from |
|
| 311 | + * @param integer $to |
|
| 308 | 312 | */ |
| 309 | 313 | private function runRotate($from, $to) |
| 310 | 314 | { |
@@ -74,13 +74,13 @@ |
||
| 74 | 74 | |
| 75 | 75 | $this->ioContainer = new Container(); |
| 76 | 76 | |
| 77 | - $this->ioContainer->statusReader = function () use ($statusFile) { |
|
| 77 | + $this->ioContainer->statusReader = function() use ($statusFile) { |
|
| 78 | 78 | return new FileReader($statusFile); |
| 79 | 79 | }; |
| 80 | - $this->ioContainer->statusWriter = function () use ($statusFile) { |
|
| 80 | + $this->ioContainer->statusWriter = function() use ($statusFile) { |
|
| 81 | 81 | return new SimpleFileWriter($statusFile->getFilePath()); |
| 82 | 82 | }; |
| 83 | - $this->ioContainer->logWriter = function () use ($logFile) { |
|
| 83 | + $this->ioContainer->logWriter = function() use ($logFile) { |
|
| 84 | 84 | return new SimpleFileWriter($logFile->getFilePath()); |
| 85 | 85 | }; |
| 86 | 86 | |
@@ -185,6 +185,7 @@ |
||
| 185 | 185 | /** |
| 186 | 186 | * ログローテートサイクルを時間に変換 |
| 187 | 187 | * @param string ローテートサイクル |
| 188 | + * @param string $cycle |
|
| 188 | 189 | * @return int ローテート時間 |
| 189 | 190 | * @throws LoggerException |
| 190 | 191 | */ |
@@ -74,11 +74,11 @@ |
||
| 74 | 74 | public function load() |
| 75 | 75 | { |
| 76 | 76 | $this->loadLogLevel() |
| 77 | - ->loadLogFilePath() |
|
| 78 | - ->loadRotateCycle() |
|
| 79 | - ->loadRotateSize() |
|
| 80 | - ->loadApplicationName() |
|
| 81 | - ->loadFormat(); |
|
| 77 | + ->loadLogFilePath() |
|
| 78 | + ->loadRotateCycle() |
|
| 79 | + ->loadRotateSize() |
|
| 80 | + ->loadApplicationName() |
|
| 81 | + ->loadFormat(); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -54,13 +54,13 @@ 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 | 61 | return new File($rootDir . "/" . $configMap["path"]); |
| 62 | 62 | }; |
| 63 | - $this->ioContainer->fileWriter = function () use ($rootDir, $configMap) { |
|
| 63 | + $this->ioContainer->fileWriter = function() use ($rootDir, $configMap) { |
|
| 64 | 64 | return new SimpleFileWriter($rootDir . "/" . $configMap["path"]); |
| 65 | 65 | }; |
| 66 | 66 | |
@@ -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 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * フォーマット済みメッセージを返却する |
| 35 | 35 | * @param string メッセージ |
| 36 | 36 | * @param string ログレベル |
| 37 | - * @return フォーマット済みメッセージ |
|
| 37 | + * @return string |
|
| 38 | 38 | */ |
| 39 | 39 | public function getFormattedMessage($message, $logLevel) |
| 40 | 40 | { |
@@ -72,8 +72,7 @@ |
||
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * キーの値を設定する |
| 75 | - * @param string $name メソッド名 |
|
| 76 | - * @param array $arguments 引数リスト |
|
| 75 | + * @param string $key |
|
| 77 | 76 | * @return void |
| 78 | 77 | */ |
| 79 | 78 | public function set($key, $value) |
@@ -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(string $filePath) |
| 36 | 36 | { |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace WebStream\IO; |
| 3 | 3 | |
| 4 | 4 | use WebStream\Exception\Extend\InvalidArgumentException; |
| 5 | -use WebStream\Exception\Extend\IOException; |
|
| 6 | 5 | |
| 7 | 6 | /** |
| 8 | 7 | * StringInputStream |
@@ -72,8 +72,7 @@ |
||
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * キーの値を設定する |
| 75 | - * @param string $name メソッド名 |
|
| 76 | - * @param array $arguments 引数リスト |
|
| 75 | + * @param string $key |
|
| 77 | 76 | * @return void |
| 78 | 77 | */ |
| 79 | 78 | public function set($key, $value) |
@@ -14,21 +14,21 @@ discard block |
||
| 14 | 14 | public function fileProvider() |
| 15 | 15 | { |
| 16 | 16 | return [ |
| 17 | - [new File(dirname(__FILE__) . "/../Fixtures/file-test1.txt")] |
|
| 17 | + [new File(dirname(__FILE__) . "/../Fixtures/file-test1.txt")] |
|
| 18 | 18 | ]; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function directoryProvider() |
| 22 | 22 | { |
| 23 | 23 | return [ |
| 24 | - [new File(dirname(__FILE__) . "/../Fixtures/file-test/")] |
|
| 24 | + [new File(dirname(__FILE__) . "/../Fixtures/file-test/")] |
|
| 25 | 25 | ]; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function fileLinkProvider() |
| 29 | 29 | { |
| 30 | 30 | return [ |
| 31 | - [new File(dirname(__FILE__) . "/../Fixtures/file-test1.txt"), "/tmp/file-test-link"] |
|
| 31 | + [new File(dirname(__FILE__) . "/../Fixtures/file-test1.txt"), "/tmp/file-test-link"] |
|
| 32 | 32 | ]; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function renameFailureProvider() |
| 50 | 50 | { |
| 51 | 51 | return [ |
| 52 | - [new File(dirname(__FILE__) . "/../Fixtures/file-test/file-test2.txt")] |
|
| 52 | + [new File(dirname(__FILE__) . "/../Fixtures/file-test/file-test2.txt")] |
|
| 53 | 53 | ]; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | public function readCharProvider() |
| 16 | 16 | { |
| 17 | 17 | return [ |
| 18 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a", 1], |
|
| 19 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a\n", 100], // over eof |
|
| 20 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test2.txt"), "あ", 3], |
|
| 21 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test2.txt"), "あ\n", 100], // over eof |
|
| 18 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a", 1], |
|
| 19 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a\n", 100], // over eof |
|
| 20 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test2.txt"), "あ", 3], |
|
| 21 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test2.txt"), "あ\n", 100], // over eof |
|
| 22 | 22 | [new StringInputStream("a"), "a", 1], |
| 23 | 23 | [new StringInputStream("a"), "a", 100], // over eof |
| 24 | 24 | [new StringInputStream("あ"), "あ", 3], |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function readLineProvider() |
| 30 | 30 | { |
| 31 | 31 | return [ |
| 32 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test3.txt"), "test1", "test2"], |
|
| 32 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test3.txt"), "test1", "test2"], |
|
| 33 | 33 | [new StringInputStream("test1\ntest2\n"), "test1", "test2"] |
| 34 | 34 | ]; |
| 35 | 35 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function closeProvider() |
| 38 | 38 | { |
| 39 | 39 | return [ |
| 40 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt")], |
|
| 40 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt")], |
|
| 41 | 41 | [new StringInputStream("a\n")] |
| 42 | 42 | ]; |
| 43 | 43 | } |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | public function skipProvider() |
| 46 | 46 | { |
| 47 | 47 | return [ |
| 48 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "a", 0], |
|
| 49 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "b", 1], |
|
| 50 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "d", 3], |
|
| 51 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "f", 5], |
|
| 52 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "\n", 9], |
|
| 53 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "", 10], |
|
| 48 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "a", 0], |
|
| 49 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "b", 1], |
|
| 50 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "d", 3], |
|
| 51 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "f", 5], |
|
| 52 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "\n", 9], |
|
| 53 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "", 10], |
|
| 54 | 54 | [new StringInputStream("abcdefghi"), "a", 0], |
| 55 | 55 | [new StringInputStream("abcdefghi"), "b", 1], |
| 56 | 56 | [new StringInputStream("abcdefghi"), "d", 3], |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | public function overSkipAndReadProvider() |
| 64 | 64 | { |
| 65 | 65 | return [ |
| 66 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test5.txt"), 4], |
|
| 67 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test6.txt"), 100], |
|
| 66 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test5.txt"), 4], |
|
| 67 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test6.txt"), 100], |
|
| 68 | 68 | [new StringInputStream("abc\n"), 4], |
| 69 | 69 | [new StringInputStream("abcde\nあいうえお"), 100] |
| 70 | 70 | ]; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function frontSkipProvider() |
| 74 | 74 | { |
| 75 | 75 | return [ |
| 76 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test8.txt"), 3, -1, "c"], |
|
| 76 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test8.txt"), 3, -1, "c"], |
|
| 77 | 77 | [new StringInputStream("abcde\n"), 3, -1, "c"] |
| 78 | 78 | ]; |
| 79 | 79 | } |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | public function overFrontSkipProvider() |
| 82 | 82 | { |
| 83 | 83 | return [ |
| 84 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -1], |
|
| 85 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -100], |
|
| 84 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -1], |
|
| 85 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -100], |
|
| 86 | 86 | [new StringInputStream("a\n"), -1], |
| 87 | 87 | [new StringInputStream("a\n"), -100] |
| 88 | 88 | ]; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public function resetProvider() |
| 92 | 92 | { |
| 93 | 93 | return [ |
| 94 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), 1, "a"], |
|
| 94 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), 1, "a"], |
|
| 95 | 95 | [new StringInputStream("a\n"), 1, "a"] |
| 96 | 96 | ]; |
| 97 | 97 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | public function markAndResetProvider() |
| 100 | 100 | { |
| 101 | 101 | return [ |
| 102 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test7.txt"), 3, "d"], |
|
| 102 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test7.txt"), 3, "d"], |
|
| 103 | 103 | [new StringInputStream("abcde\n"), 3, "d"] |
| 104 | 104 | ]; |
| 105 | 105 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | public function invalidLengthProvider() |
| 108 | 108 | { |
| 109 | 109 | return [ |
| 110 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a"], |
|
| 110 | + [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a"], |
|
| 111 | 111 | [new StringInputStream("a\n"), "a"] |
| 112 | 112 | ]; |
| 113 | 113 | } |