Channel::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 9

Duplication

Lines 16
Ratio 100 %

Code Coverage

Tests 12
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 16
loc 16
ccs 12
cts 12
cp 1
rs 9.4285
cc 2
eloc 9
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Dalen\OWLPacketInterceptor\Packet\Electricity;
4
5
use Dalen\OWLPacketInterceptor\Packet\Base;
6
7
class Channel extends Base
8
{
9 8 View Code Duplication
    function __construct($data = NULL)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
    {
11 8
        $this->fields = array
12
        (
13 8
            'id'        => '',
14 8
            'current'   => NULL,
15 8
            'day'       => NULL,
16
        );
17
        
18 8
        if(!empty($data))
19 8
        {
20 8
            parent::__construct(array('id' => $data['id']));
21 8
            $this->fields['current'] = new Current($data['curr']);
22 8
            $this->fields['day'] = new Day($data['day']);
23 8
        }
24
    }
25
}