DataConfigurator::wireModel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Nip\Records\Mapping\Configurator;
4
5
use Nip\Records\Mapping\MappingData;
6
use Nip\Records\AbstractModels\RecordManager;
7
8
/**
9
 * Class DataConfigurator
10
 * @package Nip\Records\Mapping\Configurator
11
 */
12
class DataConfigurator
13
{
14
    /**
15
     * @param RecordManager $manager
16
     * @param MappingData $data
17
     */
18 2
    public static function wire(RecordManager $manager, MappingData $data)
19
    {
20 2
        static::wireTable($manager, $data);
21 2
        static::wireController($manager, $data);
22 2
        static::wireModel($manager, $data);
23 2
        static::wireFields($manager, $data);
24 2
        static::wireTableStructure($manager, $data);
25 2
        static::wireBootTraits($manager, $data);
26 2
    }
27
28
    /**
29
     * @param RecordManager $manager
30
     * @param MappingData $data
31
     */
32 2
    protected static function wireTable(RecordManager $manager, MappingData $data)
33
    {
34 2
        $data->setTable($manager->getTable());
35 2
    }
36
37
    /**
38
     * @param RecordManager $manager
39
     * @param MappingData $data
40
     */
41 2
    protected static function wireController(RecordManager $manager, MappingData $data)
42
    {
43 2
        $data->setController($manager->getController());
44 2
    }
45
46
    /**
47
     * @param RecordManager $manager
48
     * @param MappingData $data
49
     */
50 2
    protected static function wireModel(RecordManager $manager, MappingData $data)
51
    {
52 2
        $data->setModel($manager->getModel());
53 2
    }
54
55
    /**
56
     * @param RecordManager $manager
57
     * @param MappingData $data
58
     */
59 2
    protected static function wireFields(RecordManager $manager, MappingData $data)
60
    {
61 2
        $data->setFields($manager->getFields());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $manager->getFields() targeting Nip\Records\AbstractMode...ordManager::getFields() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
62 2
    }
63
64
    /**
65
     * @param RecordManager $manager
66
     * @param MappingData $data
67
     */
68 2
    protected static function wireTableStructure(RecordManager $manager, MappingData $data)
69
    {
70 2
        $data->setTableStructure($manager->getTableStructure());
71 2
    }
72
73
    /**
74
     * @param RecordManager $manager
75
     * @param MappingData $data
76
     */
77 2
    protected static function wireBootTraits(RecordManager $manager, MappingData $data)
78
    {
79 2
        $data->setBootTraits($manager->getBootTraits());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $manager->getBootTraits() targeting Nip\Records\AbstractMode...anager::getBootTraits() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
80 2
    }
81
}
82