Total Complexity | 6 |
Total Lines | 101 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
22 | class Client { |
||
23 | /** |
||
24 | * Error. |
||
25 | * |
||
26 | * @var WP_Error |
||
27 | */ |
||
28 | private $error; |
||
29 | |||
30 | /** |
||
31 | * API URL. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | public $api_url; |
||
36 | |||
37 | /** |
||
38 | * PSP ID. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | public $psp_id; |
||
43 | |||
44 | /** |
||
45 | * SHA IN. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | public $sha_in; |
||
50 | |||
51 | /** |
||
52 | * User ID. |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | public $user_id; |
||
57 | |||
58 | /** |
||
59 | * Password. |
||
60 | * |
||
61 | * @var string |
||
62 | */ |
||
63 | public $password; |
||
64 | |||
65 | /** |
||
66 | * Constructs and initializes an Ogone DirectLink client |
||
67 | */ |
||
68 | public function __construct() { |
||
69 | $this->api_url = DirectLink::API_PRODUCTION_URL; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * Get error |
||
74 | * |
||
75 | * @return WP_Error |
||
76 | */ |
||
77 | public function get_error() { |
||
78 | return $this->error; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * Order direct |
||
83 | * |
||
84 | * @param array $data Data. |
||
85 | * |
||
86 | * @return bool|OrderResponse |
||
87 | */ |
||
88 | public function order_direct( array $data = array() ) { |
||
123 | } |
||
124 | } |
||
125 |
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 theid
property of an instance of theAccount
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.