Utility   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 23
rs 10
c 2
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRenderer() 0 13 3
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Xoopsheadline;
4
5
//use XoopsModules\Xoopsheadline\Constants;
6
7
/**
8
 * Class Utility
9
 */
10
class Utility extends Common\SysUtility
11
{
12
    //--------------- Custom module methods -----------------------------
13
    /**
14
     * Utility
15
     *
16
     * Function to create appropriate Renderer
17
     * (based on locale)
18
     * @return HeadlineRenderer|HeadlineRendererLocal
19
     */
20
    public static function getRenderer(Headline $headline)
21
    {
22
        if (\is_file(XOOPS_ROOT_PATH . '/modules/xoopsheadline/language/' . $GLOBALS['xoopsConfig']['language'] . '/headlinerenderer.php')) {
23
            require_once XOOPS_ROOT_PATH . '/modules/xoopsheadline/language/' . $GLOBALS['xoopsConfig']['language'] . '/headlinerenderer.php';
24
            if (\class_exists('HeadlineRendererLocal')) {
25
                $myhl = new HeadlineRendererLocal($headline);
0 ignored issues
show
Bug introduced by
The type XoopsModules\Xoopsheadline\HeadlineRendererLocal was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
27
                return $myhl;
28
            }
29
        }
30
        $myhl = new HeadlineRenderer($headline);
31
32
        return $myhl;
33
    }
34
}
35