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

Utility   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRenderer() 0 13 3
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