Completed
Push — master ( 5ea4f0...925a81 )
by Silvan
02:06
created

Module::jsonLoad()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 6
1
<?php
2
3
namespace dev7ch\slick;
4
5
/**
6
 * Slick.js slider LUYA module.
7
 *
8
 * @author Silvan Hahn <[email protected]>
9
 */
10
class Module extends \luya\base\Module
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 2
    public static function onLoad()
16
    {
17 2
        self::registerTranslation('slick*', static::staticBasePath().'/messages', [
18 2
            'fileMap' => [
19
                'slick' => 'slick.php',
20
            ],
21
        ]);
22 2
    }
23
24
    /**
25
     * Translations.
26
     *
27
     * @param $message
28
     * @param array $params
29
     * @param $category
30
     *
31
     * @internal param unknown $language
32
     *
33
     * @return string
34
     */
35 1
    public static function t($message, array $params = [], $category = 'slick')
36
    {
37 1
        return parent::baseT($category, $message, $params);
0 ignored issues
show
Documentation introduced by
$category is of type string, but the function expects a object<luya\base\unknown>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (baseT() instead of t()). Are you sure this is correct? If so, you might want to change this to $this->baseT().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
38
    }
39
40
}
41