ParserVarRtc   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 33
ccs 19
cts 19
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getEntity() 0 3 1
A getProperties() 0 19 1
1
<?php
2
/**
3
 * This file is part of graze/unicontroller-client.
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/unicontroller-client/blob/master/LICENSE.md
11
 * @link https://github.com/graze/unicontroller-client
12
 */
13
namespace Graze\UnicontrollerClient\Parser\Parser;
14
15
use Graze\UnicontrollerClient\Parser\Parser\AbstractParser;
16
use Graze\UnicontrollerClient\Parser\Parser\ParserInterface;
17
use Graze\UnicontrollerClient\Entity\Entity\EntityVarRtc;
18
19
class ParserVarRtc extends AbstractParser implements ParserInterface
20
{
21
    /**
22
     * @return []
0 ignored issues
show
Documentation Bug introduced by
The doc comment [] at position 0 could not be parsed: Unknown type name '[' at position 0 in [].
Loading history...
23
     */
24 2
    protected function getProperties()
25
    {
26
        return [
27 2
            'name',
28 2
            'format',
29 2
            'offsetType',
30 2
            'offsetValue',
31 2
            'offset2Type',
32 2
            'offset2Value',
33 2
            'truncateDay',
34 2
            'updatePolicy',
35 2
            'updateDay',
36 2
            'updateHour',
37 2
            'updateMinutte',
38 2
            'language',
39 2
            'variableOffset',
40 2
            'dataSource',
41 2
            'cPadding',
42
            'length'
43 2
        ];
44
    }
45
46
    /**
47
     * @return EntityVarRtc
48
     */
49 2
    protected function getEntity()
50
    {
51 2
        return new EntityVarRtc();
0 ignored issues
show
Bug Best Practice introduced by
The expression return new Graze\Unicont...y\Entity\EntityVarRtc() returns the type Graze\UnicontrollerClien...ity\Entity\EntityVarRtc which is incompatible with the return type mandated by Graze\UnicontrollerClien...ractParser::getEntity() of Graze\UnicontrollerClien...\Entity\EntityInterface.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
52
    }
53
}
54