@@ -126,12 +126,12 @@ |
||
| 126 | 126 | $hosts = $this->configService->getElasticHost(); |
| 127 | 127 | foreach ($hosts as $host) { |
| 128 | 128 | $parsedHost = parse_url($host); |
| 129 | - $safeHost = $parsedHost['scheme'] . '://'; |
|
| 129 | + $safeHost = $parsedHost['scheme'].'://'; |
|
| 130 | 130 | if (array_key_exists('user', $parsedHost)) { |
| 131 | - $safeHost .= $parsedHost['user'] . ':' . '********' . '@'; |
|
| 131 | + $safeHost .= $parsedHost['user'].':'.'********'.'@'; |
|
| 132 | 132 | } |
| 133 | 133 | $safeHost .= $parsedHost['host']; |
| 134 | - $safeHost .= ':' . $parsedHost['port']; |
|
| 134 | + $safeHost .= ':'.$parsedHost['port']; |
|
| 135 | 135 | |
| 136 | 136 | $sanitizedHosts[] = $safeHost; |
| 137 | 137 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | foreach ($keys as $key) { |
| 405 | 405 | if (!array_key_exists($key, $arr)) { |
| 406 | 406 | throw new MalformedArrayException( |
| 407 | - 'source: ' . json_encode($arr) . ' - missing key: ' . $key |
|
| 407 | + 'source: '.json_encode($arr).' - missing key: '.$key |
|
| 408 | 408 | ); |
| 409 | 409 | } |
| 410 | 410 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | protected function cleanArray(array &$arr) { |
| 418 | 418 | $arr = array_filter( |
| 419 | 419 | $arr, |
| 420 | - function ($v) { |
|
| 420 | + function($v) { |
|
| 421 | 421 | if (is_string($v)) { |
| 422 | 422 | return ($v !== ''); |
| 423 | 423 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | 'index' => |
| 68 | 68 | [ |
| 69 | 69 | 'index' => $this->configService->getElasticIndex(), |
| 70 | - 'id' => $document->getProviderId() . ':' . $document->getId(), |
|
| 70 | + 'id' => $document->getProviderId().':'.$document->getId(), |
|
| 71 | 71 | 'body' => $this->generateIndexBody($document) |
| 72 | 72 | ] |
| 73 | 73 | ]; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'index' => |
| 96 | 96 | [ |
| 97 | 97 | 'index' => $this->configService->getElasticIndex(), |
| 98 | - 'id' => $document->getProviderId() . ':' . $document->getId(), |
|
| 98 | + 'id' => $document->getProviderId().':'.$document->getId(), |
|
| 99 | 99 | 'body' => ['doc' => $this->generateIndexBody($document)] |
| 100 | 100 | ] |
| 101 | 101 | ]; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | 'index' => |
| 126 | 126 | [ |
| 127 | 127 | 'index' => $this->configService->getElasticIndex(), |
| 128 | - 'id' => $providerId . ':' . $documentId, |
|
| 128 | + 'id' => $providerId.':'.$documentId, |
|
| 129 | 129 | ] |
| 130 | 130 | ]; |
| 131 | 131 | |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | class SearchMappingService { |
| 50 | 50 | |
| 51 | - public function __construct |
|
| 52 | - ( |
|
| 51 | + public function __construct( |
|
| 53 | 52 | private ConfigService $configService |
| 54 | 53 | ) { |
| 55 | 54 | } |
@@ -275,7 +274,7 @@ discard block |
||
| 275 | 274 | |
| 276 | 275 | foreach ($request->getWildcardFields() as $field) { |
| 277 | 276 | if (!$this->fieldIsOutLimit($request, $field)) { |
| 278 | - $queryFields[] = ['wildcard' => [$field => '*' . $content->getWord() . '*']]; |
|
| 277 | + $queryFields[] = ['wildcard' => [$field => '*'.$content->getWord().'*']]; |
|
| 279 | 278 | } |
| 280 | 279 | } |
| 281 | 280 | |
@@ -439,7 +438,7 @@ discard block |
||
| 439 | 438 | public function getDocumentQuery(string $providerId, string $documentId): array { |
| 440 | 439 | return [ |
| 441 | 440 | 'index' => $this->configService->getElasticIndex(), |
| 442 | - 'id' => $providerId . ':' . $documentId |
|
| 441 | + 'id' => $providerId.':'.$documentId |
|
| 443 | 442 | ]; |
| 444 | 443 | } |
| 445 | 444 | |
@@ -451,8 +450,8 @@ discard block |
||
| 451 | 450 | */ |
| 452 | 451 | private function getPartsFields(ISearchRequest $request): array { |
| 453 | 452 | return array_map( |
| 454 | - function (string $value): string { |
|
| 455 | - return 'parts.' . $value; |
|
| 453 | + function(string $value): string { |
|
| 454 | + return 'parts.'.$value; |
|
| 456 | 455 | }, $request->getParts() |
| 457 | 456 | ); |
| 458 | 457 | } |
@@ -145,7 +145,7 @@ |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return $this->config->getSystemValueString( |
| 148 | - Application::APP_NAME . '.' . $key, |
|
| 148 | + Application::APP_NAME.'.'.$key, |
|
| 149 | 149 | (string)$this->config->getAppValue(Application::APP_NAME, $key, $defaultValue) |
| 150 | 150 | ); |
| 151 | 151 | } |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | * reduce boilerplate code that a simple Logger that does the same thing with |
| 11 | 11 | * messages regardless of the error level has to implement. |
| 12 | 12 | */ |
| 13 | -trait LoggerTrait |
|
| 14 | -{ |
|
| 13 | +trait LoggerTrait { |
|
| 15 | 14 | /** |
| 16 | 15 | * System is unusable. |
| 17 | 16 | * |
@@ -12,123 +12,123 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | trait LoggerTrait |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * System is unusable. |
|
| 17 | - * |
|
| 18 | - * @param string $message |
|
| 19 | - * @param array $context |
|
| 20 | - * |
|
| 21 | - * @return void |
|
| 22 | - */ |
|
| 23 | - public function emergency($message, array $context = array()) |
|
| 24 | - { |
|
| 25 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
| 26 | - } |
|
| 27 | - /** |
|
| 28 | - * Action must be taken immediately. |
|
| 29 | - * |
|
| 30 | - * Example: Entire website down, database unavailable, etc. This should |
|
| 31 | - * trigger the SMS alerts and wake you up. |
|
| 32 | - * |
|
| 33 | - * @param string $message |
|
| 34 | - * @param array $context |
|
| 35 | - * |
|
| 36 | - * @return void |
|
| 37 | - */ |
|
| 38 | - public function alert($message, array $context = array()) |
|
| 39 | - { |
|
| 40 | - $this->log(LogLevel::ALERT, $message, $context); |
|
| 41 | - } |
|
| 42 | - /** |
|
| 43 | - * Critical conditions. |
|
| 44 | - * |
|
| 45 | - * Example: Application component unavailable, unexpected exception. |
|
| 46 | - * |
|
| 47 | - * @param string $message |
|
| 48 | - * @param array $context |
|
| 49 | - * |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function critical($message, array $context = array()) |
|
| 53 | - { |
|
| 54 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
| 55 | - } |
|
| 56 | - /** |
|
| 57 | - * Runtime errors that do not require immediate action but should typically |
|
| 58 | - * be logged and monitored. |
|
| 59 | - * |
|
| 60 | - * @param string $message |
|
| 61 | - * @param array $context |
|
| 62 | - * |
|
| 63 | - * @return void |
|
| 64 | - */ |
|
| 65 | - public function error($message, array $context = array()) |
|
| 66 | - { |
|
| 67 | - $this->log(LogLevel::ERROR, $message, $context); |
|
| 68 | - } |
|
| 69 | - /** |
|
| 70 | - * Exceptional occurrences that are not errors. |
|
| 71 | - * |
|
| 72 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
| 73 | - * that are not necessarily wrong. |
|
| 74 | - * |
|
| 75 | - * @param string $message |
|
| 76 | - * @param array $context |
|
| 77 | - * |
|
| 78 | - * @return void |
|
| 79 | - */ |
|
| 80 | - public function warning($message, array $context = array()) |
|
| 81 | - { |
|
| 82 | - $this->log(LogLevel::WARNING, $message, $context); |
|
| 83 | - } |
|
| 84 | - /** |
|
| 85 | - * Normal but significant events. |
|
| 86 | - * |
|
| 87 | - * @param string $message |
|
| 88 | - * @param array $context |
|
| 89 | - * |
|
| 90 | - * @return void |
|
| 91 | - */ |
|
| 92 | - public function notice($message, array $context = array()) |
|
| 93 | - { |
|
| 94 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
| 95 | - } |
|
| 96 | - /** |
|
| 97 | - * Interesting events. |
|
| 98 | - * |
|
| 99 | - * Example: User logs in, SQL logs. |
|
| 100 | - * |
|
| 101 | - * @param string $message |
|
| 102 | - * @param array $context |
|
| 103 | - * |
|
| 104 | - * @return void |
|
| 105 | - */ |
|
| 106 | - public function info($message, array $context = array()) |
|
| 107 | - { |
|
| 108 | - $this->log(LogLevel::INFO, $message, $context); |
|
| 109 | - } |
|
| 110 | - /** |
|
| 111 | - * Detailed debug information. |
|
| 112 | - * |
|
| 113 | - * @param string $message |
|
| 114 | - * @param array $context |
|
| 115 | - * |
|
| 116 | - * @return void |
|
| 117 | - */ |
|
| 118 | - public function debug($message, array $context = array()) |
|
| 119 | - { |
|
| 120 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
| 121 | - } |
|
| 122 | - /** |
|
| 123 | - * Logs with an arbitrary level. |
|
| 124 | - * |
|
| 125 | - * @param mixed $level |
|
| 126 | - * @param string $message |
|
| 127 | - * @param array $context |
|
| 128 | - * |
|
| 129 | - * @return void |
|
| 130 | - * |
|
| 131 | - * @throws \Psr\Log\InvalidArgumentException |
|
| 132 | - */ |
|
| 133 | - public abstract function log($level, $message, array $context = array()); |
|
| 15 | + /** |
|
| 16 | + * System is unusable. |
|
| 17 | + * |
|
| 18 | + * @param string $message |
|
| 19 | + * @param array $context |
|
| 20 | + * |
|
| 21 | + * @return void |
|
| 22 | + */ |
|
| 23 | + public function emergency($message, array $context = array()) |
|
| 24 | + { |
|
| 25 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
| 26 | + } |
|
| 27 | + /** |
|
| 28 | + * Action must be taken immediately. |
|
| 29 | + * |
|
| 30 | + * Example: Entire website down, database unavailable, etc. This should |
|
| 31 | + * trigger the SMS alerts and wake you up. |
|
| 32 | + * |
|
| 33 | + * @param string $message |
|
| 34 | + * @param array $context |
|
| 35 | + * |
|
| 36 | + * @return void |
|
| 37 | + */ |
|
| 38 | + public function alert($message, array $context = array()) |
|
| 39 | + { |
|
| 40 | + $this->log(LogLevel::ALERT, $message, $context); |
|
| 41 | + } |
|
| 42 | + /** |
|
| 43 | + * Critical conditions. |
|
| 44 | + * |
|
| 45 | + * Example: Application component unavailable, unexpected exception. |
|
| 46 | + * |
|
| 47 | + * @param string $message |
|
| 48 | + * @param array $context |
|
| 49 | + * |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function critical($message, array $context = array()) |
|
| 53 | + { |
|
| 54 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
| 55 | + } |
|
| 56 | + /** |
|
| 57 | + * Runtime errors that do not require immediate action but should typically |
|
| 58 | + * be logged and monitored. |
|
| 59 | + * |
|
| 60 | + * @param string $message |
|
| 61 | + * @param array $context |
|
| 62 | + * |
|
| 63 | + * @return void |
|
| 64 | + */ |
|
| 65 | + public function error($message, array $context = array()) |
|
| 66 | + { |
|
| 67 | + $this->log(LogLevel::ERROR, $message, $context); |
|
| 68 | + } |
|
| 69 | + /** |
|
| 70 | + * Exceptional occurrences that are not errors. |
|
| 71 | + * |
|
| 72 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
| 73 | + * that are not necessarily wrong. |
|
| 74 | + * |
|
| 75 | + * @param string $message |
|
| 76 | + * @param array $context |
|
| 77 | + * |
|
| 78 | + * @return void |
|
| 79 | + */ |
|
| 80 | + public function warning($message, array $context = array()) |
|
| 81 | + { |
|
| 82 | + $this->log(LogLevel::WARNING, $message, $context); |
|
| 83 | + } |
|
| 84 | + /** |
|
| 85 | + * Normal but significant events. |
|
| 86 | + * |
|
| 87 | + * @param string $message |
|
| 88 | + * @param array $context |
|
| 89 | + * |
|
| 90 | + * @return void |
|
| 91 | + */ |
|
| 92 | + public function notice($message, array $context = array()) |
|
| 93 | + { |
|
| 94 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
| 95 | + } |
|
| 96 | + /** |
|
| 97 | + * Interesting events. |
|
| 98 | + * |
|
| 99 | + * Example: User logs in, SQL logs. |
|
| 100 | + * |
|
| 101 | + * @param string $message |
|
| 102 | + * @param array $context |
|
| 103 | + * |
|
| 104 | + * @return void |
|
| 105 | + */ |
|
| 106 | + public function info($message, array $context = array()) |
|
| 107 | + { |
|
| 108 | + $this->log(LogLevel::INFO, $message, $context); |
|
| 109 | + } |
|
| 110 | + /** |
|
| 111 | + * Detailed debug information. |
|
| 112 | + * |
|
| 113 | + * @param string $message |
|
| 114 | + * @param array $context |
|
| 115 | + * |
|
| 116 | + * @return void |
|
| 117 | + */ |
|
| 118 | + public function debug($message, array $context = array()) |
|
| 119 | + { |
|
| 120 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
| 121 | + } |
|
| 122 | + /** |
|
| 123 | + * Logs with an arbitrary level. |
|
| 124 | + * |
|
| 125 | + * @param mixed $level |
|
| 126 | + * @param string $message |
|
| 127 | + * @param array $context |
|
| 128 | + * |
|
| 129 | + * @return void |
|
| 130 | + * |
|
| 131 | + * @throws \Psr\Log\InvalidArgumentException |
|
| 132 | + */ |
|
| 133 | + public abstract function log($level, $message, array $context = array()); |
|
| 134 | 134 | } |
@@ -17,8 +17,7 @@ |
||
| 17 | 17 | * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md |
| 18 | 18 | * for the full interface specification. |
| 19 | 19 | */ |
| 20 | -interface LoggerInterface |
|
| 21 | -{ |
|
| 20 | +interface LoggerInterface { |
|
| 22 | 21 | /** |
| 23 | 22 | * System is unusable. |
| 24 | 23 | * |
@@ -19,99 +19,99 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | interface LoggerInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * System is unusable. |
|
| 24 | - * |
|
| 25 | - * @param string $message |
|
| 26 | - * @param mixed[] $context |
|
| 27 | - * |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public function emergency($message, array $context = array()); |
|
| 31 | - /** |
|
| 32 | - * Action must be taken immediately. |
|
| 33 | - * |
|
| 34 | - * Example: Entire website down, database unavailable, etc. This should |
|
| 35 | - * trigger the SMS alerts and wake you up. |
|
| 36 | - * |
|
| 37 | - * @param string $message |
|
| 38 | - * @param mixed[] $context |
|
| 39 | - * |
|
| 40 | - * @return void |
|
| 41 | - */ |
|
| 42 | - public function alert($message, array $context = array()); |
|
| 43 | - /** |
|
| 44 | - * Critical conditions. |
|
| 45 | - * |
|
| 46 | - * Example: Application component unavailable, unexpected exception. |
|
| 47 | - * |
|
| 48 | - * @param string $message |
|
| 49 | - * @param mixed[] $context |
|
| 50 | - * |
|
| 51 | - * @return void |
|
| 52 | - */ |
|
| 53 | - public function critical($message, array $context = array()); |
|
| 54 | - /** |
|
| 55 | - * Runtime errors that do not require immediate action but should typically |
|
| 56 | - * be logged and monitored. |
|
| 57 | - * |
|
| 58 | - * @param string $message |
|
| 59 | - * @param mixed[] $context |
|
| 60 | - * |
|
| 61 | - * @return void |
|
| 62 | - */ |
|
| 63 | - public function error($message, array $context = array()); |
|
| 64 | - /** |
|
| 65 | - * Exceptional occurrences that are not errors. |
|
| 66 | - * |
|
| 67 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
| 68 | - * that are not necessarily wrong. |
|
| 69 | - * |
|
| 70 | - * @param string $message |
|
| 71 | - * @param mixed[] $context |
|
| 72 | - * |
|
| 73 | - * @return void |
|
| 74 | - */ |
|
| 75 | - public function warning($message, array $context = array()); |
|
| 76 | - /** |
|
| 77 | - * Normal but significant events. |
|
| 78 | - * |
|
| 79 | - * @param string $message |
|
| 80 | - * @param mixed[] $context |
|
| 81 | - * |
|
| 82 | - * @return void |
|
| 83 | - */ |
|
| 84 | - public function notice($message, array $context = array()); |
|
| 85 | - /** |
|
| 86 | - * Interesting events. |
|
| 87 | - * |
|
| 88 | - * Example: User logs in, SQL logs. |
|
| 89 | - * |
|
| 90 | - * @param string $message |
|
| 91 | - * @param mixed[] $context |
|
| 92 | - * |
|
| 93 | - * @return void |
|
| 94 | - */ |
|
| 95 | - public function info($message, array $context = array()); |
|
| 96 | - /** |
|
| 97 | - * Detailed debug information. |
|
| 98 | - * |
|
| 99 | - * @param string $message |
|
| 100 | - * @param mixed[] $context |
|
| 101 | - * |
|
| 102 | - * @return void |
|
| 103 | - */ |
|
| 104 | - public function debug($message, array $context = array()); |
|
| 105 | - /** |
|
| 106 | - * Logs with an arbitrary level. |
|
| 107 | - * |
|
| 108 | - * @param mixed $level |
|
| 109 | - * @param string $message |
|
| 110 | - * @param mixed[] $context |
|
| 111 | - * |
|
| 112 | - * @return void |
|
| 113 | - * |
|
| 114 | - * @throws \Psr\Log\InvalidArgumentException |
|
| 115 | - */ |
|
| 116 | - public function log($level, $message, array $context = array()); |
|
| 22 | + /** |
|
| 23 | + * System is unusable. |
|
| 24 | + * |
|
| 25 | + * @param string $message |
|
| 26 | + * @param mixed[] $context |
|
| 27 | + * |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public function emergency($message, array $context = array()); |
|
| 31 | + /** |
|
| 32 | + * Action must be taken immediately. |
|
| 33 | + * |
|
| 34 | + * Example: Entire website down, database unavailable, etc. This should |
|
| 35 | + * trigger the SMS alerts and wake you up. |
|
| 36 | + * |
|
| 37 | + * @param string $message |
|
| 38 | + * @param mixed[] $context |
|
| 39 | + * |
|
| 40 | + * @return void |
|
| 41 | + */ |
|
| 42 | + public function alert($message, array $context = array()); |
|
| 43 | + /** |
|
| 44 | + * Critical conditions. |
|
| 45 | + * |
|
| 46 | + * Example: Application component unavailable, unexpected exception. |
|
| 47 | + * |
|
| 48 | + * @param string $message |
|
| 49 | + * @param mixed[] $context |
|
| 50 | + * |
|
| 51 | + * @return void |
|
| 52 | + */ |
|
| 53 | + public function critical($message, array $context = array()); |
|
| 54 | + /** |
|
| 55 | + * Runtime errors that do not require immediate action but should typically |
|
| 56 | + * be logged and monitored. |
|
| 57 | + * |
|
| 58 | + * @param string $message |
|
| 59 | + * @param mixed[] $context |
|
| 60 | + * |
|
| 61 | + * @return void |
|
| 62 | + */ |
|
| 63 | + public function error($message, array $context = array()); |
|
| 64 | + /** |
|
| 65 | + * Exceptional occurrences that are not errors. |
|
| 66 | + * |
|
| 67 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
| 68 | + * that are not necessarily wrong. |
|
| 69 | + * |
|
| 70 | + * @param string $message |
|
| 71 | + * @param mixed[] $context |
|
| 72 | + * |
|
| 73 | + * @return void |
|
| 74 | + */ |
|
| 75 | + public function warning($message, array $context = array()); |
|
| 76 | + /** |
|
| 77 | + * Normal but significant events. |
|
| 78 | + * |
|
| 79 | + * @param string $message |
|
| 80 | + * @param mixed[] $context |
|
| 81 | + * |
|
| 82 | + * @return void |
|
| 83 | + */ |
|
| 84 | + public function notice($message, array $context = array()); |
|
| 85 | + /** |
|
| 86 | + * Interesting events. |
|
| 87 | + * |
|
| 88 | + * Example: User logs in, SQL logs. |
|
| 89 | + * |
|
| 90 | + * @param string $message |
|
| 91 | + * @param mixed[] $context |
|
| 92 | + * |
|
| 93 | + * @return void |
|
| 94 | + */ |
|
| 95 | + public function info($message, array $context = array()); |
|
| 96 | + /** |
|
| 97 | + * Detailed debug information. |
|
| 98 | + * |
|
| 99 | + * @param string $message |
|
| 100 | + * @param mixed[] $context |
|
| 101 | + * |
|
| 102 | + * @return void |
|
| 103 | + */ |
|
| 104 | + public function debug($message, array $context = array()); |
|
| 105 | + /** |
|
| 106 | + * Logs with an arbitrary level. |
|
| 107 | + * |
|
| 108 | + * @param mixed $level |
|
| 109 | + * @param string $message |
|
| 110 | + * @param mixed[] $context |
|
| 111 | + * |
|
| 112 | + * @return void |
|
| 113 | + * |
|
| 114 | + * @throws \Psr\Log\InvalidArgumentException |
|
| 115 | + */ |
|
| 116 | + public function log($level, $message, array $context = array()); |
|
| 117 | 117 | } |
@@ -9,8 +9,7 @@ |
||
| 9 | 9 | * reduce boilerplate code that a simple Logger that does the same thing with |
| 10 | 10 | * messages regardless of the error level has to implement. |
| 11 | 11 | */ |
| 12 | -abstract class AbstractLogger implements LoggerInterface |
|
| 13 | -{ |
|
| 12 | +abstract class AbstractLogger implements LoggerInterface { |
|
| 14 | 13 | /** |
| 15 | 14 | * System is unusable. |
| 16 | 15 | * |
@@ -11,111 +11,111 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | abstract class AbstractLogger implements LoggerInterface |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * System is unusable. |
|
| 16 | - * |
|
| 17 | - * @param string $message |
|
| 18 | - * @param mixed[] $context |
|
| 19 | - * |
|
| 20 | - * @return void |
|
| 21 | - */ |
|
| 22 | - public function emergency($message, array $context = array()) |
|
| 23 | - { |
|
| 24 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
| 25 | - } |
|
| 26 | - /** |
|
| 27 | - * Action must be taken immediately. |
|
| 28 | - * |
|
| 29 | - * Example: Entire website down, database unavailable, etc. This should |
|
| 30 | - * trigger the SMS alerts and wake you up. |
|
| 31 | - * |
|
| 32 | - * @param string $message |
|
| 33 | - * @param mixed[] $context |
|
| 34 | - * |
|
| 35 | - * @return void |
|
| 36 | - */ |
|
| 37 | - public function alert($message, array $context = array()) |
|
| 38 | - { |
|
| 39 | - $this->log(LogLevel::ALERT, $message, $context); |
|
| 40 | - } |
|
| 41 | - /** |
|
| 42 | - * Critical conditions. |
|
| 43 | - * |
|
| 44 | - * Example: Application component unavailable, unexpected exception. |
|
| 45 | - * |
|
| 46 | - * @param string $message |
|
| 47 | - * @param mixed[] $context |
|
| 48 | - * |
|
| 49 | - * @return void |
|
| 50 | - */ |
|
| 51 | - public function critical($message, array $context = array()) |
|
| 52 | - { |
|
| 53 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
| 54 | - } |
|
| 55 | - /** |
|
| 56 | - * Runtime errors that do not require immediate action but should typically |
|
| 57 | - * be logged and monitored. |
|
| 58 | - * |
|
| 59 | - * @param string $message |
|
| 60 | - * @param mixed[] $context |
|
| 61 | - * |
|
| 62 | - * @return void |
|
| 63 | - */ |
|
| 64 | - public function error($message, array $context = array()) |
|
| 65 | - { |
|
| 66 | - $this->log(LogLevel::ERROR, $message, $context); |
|
| 67 | - } |
|
| 68 | - /** |
|
| 69 | - * Exceptional occurrences that are not errors. |
|
| 70 | - * |
|
| 71 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
| 72 | - * that are not necessarily wrong. |
|
| 73 | - * |
|
| 74 | - * @param string $message |
|
| 75 | - * @param mixed[] $context |
|
| 76 | - * |
|
| 77 | - * @return void |
|
| 78 | - */ |
|
| 79 | - public function warning($message, array $context = array()) |
|
| 80 | - { |
|
| 81 | - $this->log(LogLevel::WARNING, $message, $context); |
|
| 82 | - } |
|
| 83 | - /** |
|
| 84 | - * Normal but significant events. |
|
| 85 | - * |
|
| 86 | - * @param string $message |
|
| 87 | - * @param mixed[] $context |
|
| 88 | - * |
|
| 89 | - * @return void |
|
| 90 | - */ |
|
| 91 | - public function notice($message, array $context = array()) |
|
| 92 | - { |
|
| 93 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
| 94 | - } |
|
| 95 | - /** |
|
| 96 | - * Interesting events. |
|
| 97 | - * |
|
| 98 | - * Example: User logs in, SQL logs. |
|
| 99 | - * |
|
| 100 | - * @param string $message |
|
| 101 | - * @param mixed[] $context |
|
| 102 | - * |
|
| 103 | - * @return void |
|
| 104 | - */ |
|
| 105 | - public function info($message, array $context = array()) |
|
| 106 | - { |
|
| 107 | - $this->log(LogLevel::INFO, $message, $context); |
|
| 108 | - } |
|
| 109 | - /** |
|
| 110 | - * Detailed debug information. |
|
| 111 | - * |
|
| 112 | - * @param string $message |
|
| 113 | - * @param mixed[] $context |
|
| 114 | - * |
|
| 115 | - * @return void |
|
| 116 | - */ |
|
| 117 | - public function debug($message, array $context = array()) |
|
| 118 | - { |
|
| 119 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
| 120 | - } |
|
| 14 | + /** |
|
| 15 | + * System is unusable. |
|
| 16 | + * |
|
| 17 | + * @param string $message |
|
| 18 | + * @param mixed[] $context |
|
| 19 | + * |
|
| 20 | + * @return void |
|
| 21 | + */ |
|
| 22 | + public function emergency($message, array $context = array()) |
|
| 23 | + { |
|
| 24 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
| 25 | + } |
|
| 26 | + /** |
|
| 27 | + * Action must be taken immediately. |
|
| 28 | + * |
|
| 29 | + * Example: Entire website down, database unavailable, etc. This should |
|
| 30 | + * trigger the SMS alerts and wake you up. |
|
| 31 | + * |
|
| 32 | + * @param string $message |
|
| 33 | + * @param mixed[] $context |
|
| 34 | + * |
|
| 35 | + * @return void |
|
| 36 | + */ |
|
| 37 | + public function alert($message, array $context = array()) |
|
| 38 | + { |
|
| 39 | + $this->log(LogLevel::ALERT, $message, $context); |
|
| 40 | + } |
|
| 41 | + /** |
|
| 42 | + * Critical conditions. |
|
| 43 | + * |
|
| 44 | + * Example: Application component unavailable, unexpected exception. |
|
| 45 | + * |
|
| 46 | + * @param string $message |
|
| 47 | + * @param mixed[] $context |
|
| 48 | + * |
|
| 49 | + * @return void |
|
| 50 | + */ |
|
| 51 | + public function critical($message, array $context = array()) |
|
| 52 | + { |
|
| 53 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
| 54 | + } |
|
| 55 | + /** |
|
| 56 | + * Runtime errors that do not require immediate action but should typically |
|
| 57 | + * be logged and monitored. |
|
| 58 | + * |
|
| 59 | + * @param string $message |
|
| 60 | + * @param mixed[] $context |
|
| 61 | + * |
|
| 62 | + * @return void |
|
| 63 | + */ |
|
| 64 | + public function error($message, array $context = array()) |
|
| 65 | + { |
|
| 66 | + $this->log(LogLevel::ERROR, $message, $context); |
|
| 67 | + } |
|
| 68 | + /** |
|
| 69 | + * Exceptional occurrences that are not errors. |
|
| 70 | + * |
|
| 71 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
| 72 | + * that are not necessarily wrong. |
|
| 73 | + * |
|
| 74 | + * @param string $message |
|
| 75 | + * @param mixed[] $context |
|
| 76 | + * |
|
| 77 | + * @return void |
|
| 78 | + */ |
|
| 79 | + public function warning($message, array $context = array()) |
|
| 80 | + { |
|
| 81 | + $this->log(LogLevel::WARNING, $message, $context); |
|
| 82 | + } |
|
| 83 | + /** |
|
| 84 | + * Normal but significant events. |
|
| 85 | + * |
|
| 86 | + * @param string $message |
|
| 87 | + * @param mixed[] $context |
|
| 88 | + * |
|
| 89 | + * @return void |
|
| 90 | + */ |
|
| 91 | + public function notice($message, array $context = array()) |
|
| 92 | + { |
|
| 93 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
| 94 | + } |
|
| 95 | + /** |
|
| 96 | + * Interesting events. |
|
| 97 | + * |
|
| 98 | + * Example: User logs in, SQL logs. |
|
| 99 | + * |
|
| 100 | + * @param string $message |
|
| 101 | + * @param mixed[] $context |
|
| 102 | + * |
|
| 103 | + * @return void |
|
| 104 | + */ |
|
| 105 | + public function info($message, array $context = array()) |
|
| 106 | + { |
|
| 107 | + $this->log(LogLevel::INFO, $message, $context); |
|
| 108 | + } |
|
| 109 | + /** |
|
| 110 | + * Detailed debug information. |
|
| 111 | + * |
|
| 112 | + * @param string $message |
|
| 113 | + * @param mixed[] $context |
|
| 114 | + * |
|
| 115 | + * @return void |
|
| 116 | + */ |
|
| 117 | + public function debug($message, array $context = array()) |
|
| 118 | + { |
|
| 119 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
| 120 | + } |
|
| 121 | 121 | } |
@@ -5,8 +5,7 @@ |
||
| 5 | 5 | /** |
| 6 | 6 | * Basic Implementation of LoggerAwareInterface. |
| 7 | 7 | */ |
| 8 | -trait LoggerAwareTrait |
|
| 9 | -{ |
|
| 8 | +trait LoggerAwareTrait { |
|
| 10 | 9 | /** |
| 11 | 10 | * The logger instance. |
| 12 | 11 | * |
@@ -7,19 +7,19 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | trait LoggerAwareTrait |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * The logger instance. |
|
| 12 | - * |
|
| 13 | - * @var LoggerInterface|null |
|
| 14 | - */ |
|
| 15 | - protected $logger; |
|
| 16 | - /** |
|
| 17 | - * Sets a logger. |
|
| 18 | - * |
|
| 19 | - * @param LoggerInterface $logger |
|
| 20 | - */ |
|
| 21 | - public function setLogger(LoggerInterface $logger) |
|
| 22 | - { |
|
| 23 | - $this->logger = $logger; |
|
| 24 | - } |
|
| 10 | + /** |
|
| 11 | + * The logger instance. |
|
| 12 | + * |
|
| 13 | + * @var LoggerInterface|null |
|
| 14 | + */ |
|
| 15 | + protected $logger; |
|
| 16 | + /** |
|
| 17 | + * Sets a logger. |
|
| 18 | + * |
|
| 19 | + * @param LoggerInterface $logger |
|
| 20 | + */ |
|
| 21 | + public function setLogger(LoggerInterface $logger) |
|
| 22 | + { |
|
| 23 | + $this->logger = $logger; |
|
| 24 | + } |
|
| 25 | 25 | } |