| Conditions | 21 |
| Paths | 4 |
| Total Lines | 77 |
| Code Lines | 50 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 114 | { |
||
| 115 | /* istanbul ignore next */ |
||
| 116 | throw new InvalidCodePathException(); |
||
| 117 | } |
||
| 118 | |||
| 119 | /** |
||
| 120 | * Processes the log message. |
||
| 121 | * |
||
| 122 | * @param array &$normalized Reference to the normalized array, where all normalized data get stored. |
||
| 123 | * @param string $message The log message. |
||
| 124 | * @return void |
||
| 125 | */ |
||
| 126 | protected function processMessage(array &$normalized, string $message) |
||
| 127 | { |
||
| 128 | $normalized['@m'] = $message; |
||
| 129 | if (!(strpos($message, '{') === false)) { |
||
| 130 | $normalized['@mt'] = $message; |
||
| 131 | } |
||
| 132 | } |
||
| 133 | |||
| 134 | /** |
||
| 135 | * Processes the context array. |
||
| 136 | * |
||
| 137 | * @param array &$normalized Reference to the normalized array, where all normalized data get stored. |
||
| 138 | * @param array $message The context array. |
||
| 139 | * @return void |
||
| 140 | */ |
||
| 141 | protected function processContext(array &$normalized, array $context) |
||
| 142 | { |
||
| 143 | $this->processContextException($normalized, $context); |
||
| 144 | $array = $this->getNormalizedArray($context); |
||
| 145 | |||
| 146 | if ($this->extractContext) { |
||
| 147 | $normalized = array_merge($array, $normalized); |
||
| 148 | } else { |
||
| 149 | $normalized['Context'] = $array; |
||
| 150 | } |
||
| 151 | } |
||
| 152 | |||
| 153 | /** |
||
| 154 | * Processes the log level. |
||
| 155 | * |
||
| 156 | * @param array &$normalized Reference to the normalized array, where all normalized data get stored. |
||
| 157 | * @param int $message The log level. |
||
| 158 | * @return void |
||
| 159 | */ |
||
| 160 | protected function processLevel(array &$normalized, int $level) |
||
| 161 | { |
||
| 162 | $normalized['@l'] = $this->logLevelMap[$level]; |
||
| 163 | $normalized['Code'] = $level; |
||
| 164 | } |
||
| 165 | |||
| 166 | /** |
||
| 167 | * Processes the log level name. |
||
| 168 | * |
||
| 169 | * @param array &$normalized Reference to the normalized array, where all normalized data get stored. |
||
| 170 | * @param string $message The log level name. |
||
| 171 | * @return void |
||
| 172 | */ |
||
| 173 | protected function processLevelName(array &$normalized, string $levelName) |
||
| 174 | { |
||
| 175 | $normalized['LevelName'] = $levelName; |
||
| 176 | } |
||
| 177 | |||
| 178 | /** |
||
| 179 | * Processes the channel name. |
||
| 180 | * |
||
| 181 | * @param array &$normalized Reference to the normalized array, where all normalized data get stored. |
||
| 182 | * @param string $message The log channel name. |
||
| 183 | * @return void |
||
| 184 | */ |
||
| 185 | protected function processChannel(array &$normalized, string $name) |
||
| 186 | { |
||
| 187 | $normalized['Channel'] = $name; |
||
| 188 | } |
||
| 189 | |||
| 190 | /** |
||
| 191 | * Processes the log timestamp. |
||
| 261 | } |