Passed
Push — master ( eec3d3...7b6eed )
by Michael
02:45
created

Utility::getRenderer()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
nc 3
nop 1
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace XoopsModules\Xoopsheadline;
6
7
use XoopsModules\Xoopsheadline\Common;
8
//use XoopsModules\Xoopsheadline\Constants;
9
10
/**
11
 * Class Utility
12
 */
13
class Utility extends Common\SysUtility
14
{
15
    //--------------- Custom module methods -----------------------------
16
17
    /**
18
     * Utility
19
     *
20
     * Function to create appropriate Renderer
21
     * (based on locale)
22
     * @param $headline
23
     * @return HeadlineRenderer
24
     */
25
    public static function getRenderer(Headline $headline)
26
    {
27
        if (\is_file(XOOPS_ROOT_PATH . '/modules/xoopsheadline/language/' . $GLOBALS['xoopsConfig']['language'] . '/headlinerenderer.php')) {
28
            require_once XOOPS_ROOT_PATH . '/modules/xoopsheadline/language/' . $GLOBALS['xoopsConfig']['language'] . '/headlinerenderer.php';
29
            if (\class_exists('HeadlineRendererLocal')) {
30
                $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...
31
32
                return $myhl;
33
            }
34
        }
35
        $myhl = new HeadlineRenderer($headline);
36
37
        return $myhl;
38
    }
39
}
40