Passed
Pull Request — master (#16)
by Matthew
02:08
created

ManyHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handleManyRelationType() 0 6 3
1
<?php
2
3
namespace Dynamic\Salsify\TypeHandler\Relation;
4
5
use SilverStripe\Core\Extension;
6
use SilverStripe\ORM\DataObject;
7
8
/**
9
 * Class RelationHandler
10
 * @package Dynamic\Salsify\TypeHandler
11
 *
12
 * @property-read \Dynamic\Salsify\TypeHandler\Relation\ManyHandler|\Dynamic\Salsify\Model\Mapper $owner
13
 */
14
class ManyHandler extends Extension
15
{
16
    /**
17
     * @var array
18
     */
19
    private static $field_types = [
0 ignored issues
show
introduced by
The private property $field_types is not used, and could be removed.
Loading history...
20
        'ManyRelation'
21
    ];
22
23
    /**
24
     * @param $data
25
     * @param $dataField
26
     * @param $config
27
     * @param $dbField
28
     * @param string |\SilverStripe\ORM\DataObject $class
29
     *
30
     * @return int|DataObject|array
31
     * @throws \Exception
32
     */
33
    public function handleManyRelationType($data, $dataField, $config, $dbField, $class)
0 ignored issues
show
Unused Code introduced by
The parameter $class 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

33
    public function handleManyRelationType($data, $dataField, $config, $dbField, /** @scrutinizer ignore-unused */ $class)

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 $dataField 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

33
    public function handleManyRelationType($data, /** @scrutinizer ignore-unused */ $dataField, $config, $dbField, $class)

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 $data 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

33
    public function handleManyRelationType(/** @scrutinizer ignore-unused */ $data, $dataField, $config, $dbField, $class)

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 $dbField 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

33
    public function handleManyRelationType($data, $dataField, $config, /** @scrutinizer ignore-unused */ $dbField, $class)

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...
34
    {
35
        if (!array_key_exists('relation', $config) || !is_array($config['relation']) ) {
36
            return [];
37
        }
38
        return [];
39
    }
40
}
41