Completed
Push — master ( 9cbd00...c28291 )
by Nic
12s queued 10s
created

TestVariationDataExtension::get_extra_config()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 13
rs 10
cc 2
nc 2
nop 3
1
<?php
2
3
namespace Dynamic\Foxy\Inventory\Test\TestOnly\Extension;
4
5
use Dynamic\Foxy\Inventory\Test\TestOnly\Page\TestProduct;
6
use Dynamic\Foxy\Model\Variation;
7
use SilverStripe\ORM\DataExtension;
8
9
/**
10
 * Class TestVariationDataExtension
11
 * @package Dynamic\Foxy\Inventory\Test\TestOnly\Extension
12
 */
13
class TestVariationDataExtension extends DataExtension
14
{
15
    /**
16
     * @var string[]
17
     */
18
    private static $has_one = [
0 ignored issues
show
introduced by
The private property $has_one is not used, and could be removed.
Loading history...
19
        'Product' => TestProduct::class,
20
    ];
21
22
    /**
23
     * @param null $class
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $class is correct as it would always require null to be passed?
Loading history...
24
     * @param null $extensionClass
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $extensionClass is correct as it would always require null to be passed?
Loading history...
25
     * @param null $args
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $args is correct as it would always require null to be passed?
Loading history...
26
     * @return array
27
     */
28
    public static function get_extra_config($class = null, $extensionClass = null, $args = null)
0 ignored issues
show
Unused Code introduced by
The parameter $extensionClass is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

28
    public static function get_extra_config($class = null, /** @scrutinizer ignore-unused */ $extensionClass = null, $args = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

28
    public static function get_extra_config($class = null, $extensionClass = null, /** @scrutinizer ignore-unused */ $args = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        $config = [];
31
32
        // Only add these extensions if the $class is set to DataExtensionTest_Player, to
33
        // test that the argument works.
34
        if (strcasecmp($class, Variation::class) === 0) {
35
            $config['has_one'] = [
36
                'Product' => TestProduct::class,
37
            ];
38
        }
39
40
        return $config;
41
    }
42
}
43