ParserReadDesign::getProperties()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 28

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 27
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 28
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 30
ccs 27
cts 27
cp 1
crap 1
rs 9.472
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\EntityReadDesign;
18
19
class ParserReadDesign 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 1
    protected function getProperties()
25
    {
26
        return [
27 1
            'name',
28 1
            'height',
29 1
            'width',
30 1
            'storageMode',
31 1
            'saveDesign',
32 1
            'printDesign',
33 1
            'driverId',
34 1
            'printCount',
35 1
            'cycleSize',
36 1
            'readOk',
37 1
            'lineArray',
38 1
            'boxArray',
39 1
            'ttfArray',
40 1
            'barcodeArray',
41 1
            'pictureArray',
42 1
            'promptArray',
43 1
            'seqArray',
44 1
            'rtcArray',
45 1
            'databaseArray',
46 1
            'userIdArray',
47 1
            'shiftCodeArray',
48 1
            'machineIdArray',
49 1
            'databaseFieldArray',
50 1
            'macroArray',
51 1
            'macroOutputArray',
52 1
            'serialVarArray',
53
            'settingsArray'
54 1
        ];
55
    }
56
57
    /**
58
     * @return EntityReadDesign
59
     */
60 1
    protected function getEntity()
61
    {
62 1
        return new EntityReadDesign();
0 ignored issues
show
Bug Best Practice introduced by
The expression return new Graze\Unicont...tity\EntityReadDesign() returns the type Graze\UnicontrollerClien...Entity\EntityReadDesign 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...
63
    }
64
}
65