Conditions | 18 |
Paths | 3072 |
Total Lines | 57 |
Code Lines | 40 |
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 |
||
134 | protected function write(array $record) |
||
135 | { |
||
136 | $previousUserContext = false; |
||
137 | $options = array(); |
||
138 | $options['level'] = $this->logLevels[$record['level']]; |
||
139 | $options['tags'] = array(); |
||
140 | if (!empty($record['extra']['tags'])) { |
||
141 | $options['tags'] = array_merge($options['tags'], $record['extra']['tags']); |
||
142 | unset($record['extra']['tags']); |
||
143 | } |
||
144 | if (!empty($record['context']['tags'])) { |
||
145 | $options['tags'] = array_merge($options['tags'], $record['context']['tags']); |
||
146 | unset($record['context']['tags']); |
||
147 | } |
||
148 | if (!empty($record['context']['fingerprint'])) { |
||
149 | $options['fingerprint'] = $record['context']['fingerprint']; |
||
150 | unset($record['context']['fingerprint']); |
||
151 | } |
||
152 | if (!empty($record['context']['logger'])) { |
||
153 | $options['logger'] = $record['context']['logger']; |
||
154 | unset($record['context']['logger']); |
||
155 | } else { |
||
156 | $options['logger'] = $record['channel']; |
||
157 | } |
||
158 | foreach ($this->getExtraParameters() as $key) { |
||
159 | foreach (array('extra', 'context') as $source) { |
||
160 | if (!empty($record[$source][$key])) { |
||
161 | $options[$key] = $record[$source][$key]; |
||
162 | unset($record[$source][$key]); |
||
163 | } |
||
164 | } |
||
165 | } |
||
166 | if (!empty($record['context'])) { |
||
167 | $options['extra']['context'] = $record['context']; |
||
168 | if (!empty($record['context']['user'])) { |
||
169 | $previousUserContext = $this->ravenClient->context->user; |
||
170 | $this->ravenClient->user_context($record['context']['user']); |
||
171 | unset($options['extra']['context']['user']); |
||
172 | } |
||
173 | } |
||
174 | if (!empty($record['extra'])) { |
||
175 | $options['extra']['extra'] = $record['extra']; |
||
176 | } |
||
177 | |||
178 | if (!empty($this->release) && !isset($options['release'])) { |
||
179 | $options['release'] = $this->release; |
||
180 | } |
||
181 | |||
182 | if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) { |
||
183 | $options['extra']['message'] = $record['formatted']; |
||
184 | $this->ravenClient->captureException($record['context']['exception'], $options); |
||
185 | } else { |
||
186 | $this->ravenClient->captureMessage($record['formatted'], array(), $options); |
||
187 | } |
||
188 | |||
189 | if ($previousUserContext !== false) { |
||
190 | $this->ravenClient->user_context($previousUserContext); |
||
191 | } |
||
233 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths