Completed
Push — master ( ba6641...734696 )
by Hamoud
27:01 queued 12:22
created

GetShipUpdates::setRowId()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of Smsa WebService package.
5
 * (c) Hamoud Alhoqbani <[email protected]>
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Alhoqbani\SmsaWebService\Soap\Type;
11
12
use \WsdlToPhp\PackageBase\AbstractStructBase;
13
14
/**
15
 * This class stands for getShipUpdates Type
16
 *
17
 * @date 2018/04/06
18
 * @codeVersion 0.0.1
19
 */
20 View Code Duplication
class GetShipUpdates extends AbstractStructBase
0 ignored issues
show
Duplication introduced by
This class 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...
21
{
22
    /**
23
     * The rowId
24
     * Meta informations extracted from the WSDL
25
     * - maxOccurs: 1
26
     * - minOccurs: 1
27
     *
28
     * @var int
29
     */
30
    public $rowId;
31
    /**
32
     * The passKey
33
     * Meta informations extracted from the WSDL
34
     * - maxOccurs: 1
35
     * - minOccurs: 0
36
     *
37
     * @var string
38
     */
39
    public $passKey;
40
41
    /**
42
     * Constructor method for getShipUpdates
43
     *
44
     * @uses GetShipUpdates::setRowId()
45
     * @uses GetShipUpdates::setPassKey()
46
     *
47
     * @param int    $rowId
48
     * @param string $passKey
49
     */
50
    public function __construct($rowId = null, $passKey = null)
51
    {
52
        $this
53
            ->setRowId($rowId)
54
            ->setPassKey($passKey);
55
    }
56
57
    /**
58
     * Get rowId value
59
     *
60
     * @return int
61
     */
62
    public function getRowId()
63
    {
64
        return $this->rowId;
65
    }
66
67
    /**
68
     * Set rowId value
69
     *
70
     * @param int $rowId
71
     *
72
     * @return \Alhoqbani\SmsaWebService\Soap\Type\GetShipUpdates
73
     */
74
    public function setRowId($rowId = null)
75
    {
76
        // validation for constraint: int
77
        if (!is_null($rowId) && !is_numeric($rowId)) {
78
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a numeric value, "%s" given', gettype($rowId)), __LINE__);
79
        }
80
        $this->rowId = $rowId;
0 ignored issues
show
Documentation Bug introduced by
It seems like $rowId can also be of type double or string. However, the property $rowId is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
81
82
        return $this;
83
    }
84
85
    /**
86
     * Get passKey value
87
     *
88
     * @return string|null
89
     */
90
    public function getPassKey()
91
    {
92
        return $this->passKey;
93
    }
94
95
    /**
96
     * Set passKey value
97
     *
98
     * @param string $passKey
99
     *
100
     * @return \Alhoqbani\SmsaWebService\Soap\Type\GetShipUpdates
101
     */
102
    public function setPassKey($passKey = null)
103
    {
104
        // validation for constraint: string
105
        if (!is_null($passKey) && !is_string($passKey)) {
106
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($passKey)), __LINE__);
107
        }
108
        $this->passKey = $passKey;
109
110
        return $this;
111
    }
112
113
    /**
114
     * Method called when an object has been exported with var_export() functions
115
     * It allows to return an object instantiated with the values
116
     *
117
     * @see AbstractStructBase::__set_state()
118
     *
119
     * @uses AbstractStructBase::__set_state()
120
     *
121
     * @param array $array the exported values
122
     *
123
     * @return \Alhoqbani\SmsaWebService\Soap\Type\GetShipUpdates
124
     */
125
    public static function __set_state(array $array)
126
    {
127
        return parent::__set_state($array);
128
    }
129
130
    /**
131
     * Method returning the class name
132
     *
133
     * @return string __CLASS__
134
     */
135
    public function __toString()
136
    {
137
        return __CLASS__;
138
    }
139
}
140