Conditions | 10 |
Paths | 4 |
Total Lines | 38 |
Code Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 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 |
||
18 | public static function eventCoreIncludeCommonAuthSuccess() |
||
19 | { |
||
20 | $autoloader = dirname(__DIR__) . '/vendor/autoload.php'; |
||
21 | if (!file_exists($autoloader)) { |
||
22 | trigger_error("xwhoops25/vendor/autoload.php not found, was 'composer install' done?"); |
||
23 | return; |
||
24 | } |
||
25 | xoops_loadLanguage('logger'); |
||
26 | require_once $autoloader; |
||
27 | $permissionHelper = new Permission('xwhoops25'); |
||
28 | if ($permissionHelper) { |
||
29 | $permissionName = 'use_xwhoops'; |
||
30 | $permissionItemId = 0; |
||
31 | |||
32 | if ($permissionHelper->checkPermission($permissionName, $permissionItemId, false)) { |
||
33 | $whoops = new \Whoops\Run; |
||
34 | $handler = new \Whoops\Handler\PrettyPageHandler; |
||
35 | $whoops->pushHandler($handler); |
||
36 | $whoops->register(); |
||
37 | $handler->addDataTableCallback( |
||
38 | _LOGGER_QUERIES, |
||
39 | function () { |
||
40 | $logger = XoopsLogger::getInstance(); |
||
41 | if (false == $logger->renderingEnabled) { |
||
42 | return ['XoopsLogger' => 'off']; // logger is off so data is incomplete |
||
43 | } |
||
44 | $queries = []; |
||
45 | $count=1; |
||
46 | foreach($logger->queries as $key => $q) { |
||
47 | $error = (null===$q['errno'] ? '' : $q['errno'].' ') . (null===$q['error'] ? '' : $q['error']); |
||
48 | $queryTime = isset($q['query_time']) ? sprintf('%0.6f', $q['query_time']) : ''; |
||
49 | $queryKey = (string) $count++ . ' - ' . $queryTime; |
||
50 | if (null !== $q['errno']) { |
||
51 | $queryKey = (string) $count .' - Error' ; |
||
52 | } |
||
53 | $queries[$queryKey] = htmlentities($q['sql']) . ' ' . $error; |
||
54 | } |
||
55 | return ($queries); |
||
56 | } |
||
62 |
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