This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Billogram\Model\Setting; |
||
6 | |||
7 | use Billogram\Model\CreatableFromArray; |
||
8 | |||
9 | /** |
||
10 | * @author Ibrahim Hizeoui <[email protected]> |
||
11 | */ |
||
12 | class PaymentSetting implements CreatableFromArray |
||
13 | { |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $bankgiro; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $plusgiro; |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | private $domesticBankAccount; |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | private $internationalBankAccount; |
||
33 | |||
34 | /** |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public function getBankgiro() |
||
38 | { |
||
39 | return $this->bankgiro; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param $bankgiro |
||
44 | * |
||
45 | * @return PaymentSetting |
||
46 | */ |
||
47 | public function withBankgiro($bankgiro) |
||
48 | { |
||
49 | $new = clone $this; |
||
50 | $new->bankgiro = $bankgiro; |
||
51 | |||
52 | return $new; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getPlusgiro(): string |
||
59 | { |
||
60 | return $this->plusgiro; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param string $plusgiro |
||
65 | * |
||
66 | * @return PaymentSetting |
||
67 | */ |
||
68 | public function withPlusgiro(string $plusgiro) |
||
69 | { |
||
70 | $new = clone $this; |
||
71 | $new->plusgiro = $plusgiro; |
||
72 | |||
73 | return $new; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * @return mixed |
||
78 | */ |
||
79 | public function getDomesticBankAccount() |
||
80 | { |
||
81 | return $this->domesticBankAccount; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @param $domesticBankAccount |
||
86 | * |
||
87 | * @return PaymentSetting |
||
88 | */ |
||
89 | public function withDomesticBankAccount($domesticBankAccount) |
||
90 | { |
||
91 | $new = clone $this; |
||
92 | $new->domesticBankAccount = $domesticBankAccount; |
||
93 | |||
94 | return $new; |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * @return mixed |
||
99 | */ |
||
100 | public function getInternationalBankAccount() |
||
101 | { |
||
102 | return $this->internationalBankAccount; |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * @param $internationalBankAccount |
||
107 | * |
||
108 | * @return PaymentSetting |
||
109 | */ |
||
110 | public function withInternationalBankAccount($internationalBankAccount) |
||
111 | { |
||
112 | $new = clone $this; |
||
113 | $new->internationalBankAccount = $internationalBankAccount; |
||
114 | |||
115 | return $new; |
||
116 | } |
||
117 | |||
118 | /** |
||
119 | * Create an API response object from the HTTP response from the API server. |
||
120 | * |
||
121 | * @param array $data |
||
122 | * |
||
123 | * @return self |
||
124 | */ |
||
125 | 2 | public static function createFromArray(array $data) |
|
126 | { |
||
127 | 2 | $paymentSetting = new self(); |
|
128 | 2 | $paymentSetting->bankgiro = $data['bankgiro'] ?? null; |
|
129 | 2 | $paymentSetting->plusgiro = $data['plusgiro'] ?? null; |
|
130 | 2 | $paymentSetting->domesticBankAccount = ['account_no' => $data['domestic_bank_account']['account_no'], 'clearing_no' => $data['domestic_bank_account']['clearing_no']] ?? null; |
|
0 ignored issues
–
show
|
|||
131 | 2 | $paymentSetting->internationalBankAccount = ['bank' => $data['international_bank_account']['bank'], 'iban' => $data['international_bank_account']['iban'], 'bic' => $data['international_bank_account']['bic'], 'swift' => $data['international_bank_account']['swift']] ?? null; |
|
0 ignored issues
–
show
It seems like
array('bank' => $data['i...unt']['swift']) ?? null can be null . However, the property $internationalBankAccount is declared as array . Maybe change the type of the property to array|null or add a type check?
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property. To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter. function aContainsB(array $needle = null, array $haystack) {
if (!$needle) {
return false;
}
return array_intersect($haystack, $needle) == $haystack;
}
The function can be called with either null or an array for the parameter
Loading history...
|
|||
132 | |||
133 | 2 | return $paymentSetting; |
|
134 | } |
||
135 | |||
136 | 1 | public function toArray() |
|
137 | { |
||
138 | 1 | $data = []; |
|
139 | 1 | if (null !== $this->bankgiro) { |
|
140 | 1 | $data['bankgiro'] = $this->bankgiro; |
|
141 | } |
||
142 | 1 | if (null !== $this->plusgiro) { |
|
143 | 1 | $data['plusgiro'] = $this->plusgiro; |
|
144 | } |
||
145 | 1 | if (null !== $this->domesticBankAccount['account_no'] && null !== $this->domesticBankAccount['clearing_no']) { |
|
146 | 1 | $data['domestic_bank_account']['account_no'] = $this->domesticBankAccount['account_no']; |
|
147 | 1 | $data['domestic_bank_account']['clearing_no'] = $this->domesticBankAccount['clearing_no']; |
|
148 | } |
||
149 | 1 | if (null !== $this->internationalBankAccount['iban']) { |
|
150 | 1 | $data['international_bank_account']['iban'] = $this->internationalBankAccount['iban']; |
|
151 | |||
152 | 1 | View Code Duplication | if (null !== $this->internationalBankAccount['iban'] && null !== $this->internationalBankAccount['bank']) { |
153 | 1 | $data['international_bank_account']['bank'] = $this->internationalBankAccount['bank']; |
|
154 | } |
||
155 | 1 | View Code Duplication | if (null !== $this->internationalBankAccount['bic']) { |
156 | 1 | $data['international_bank_account']['bic'] = $this->internationalBankAccount['bic']; |
|
157 | } |
||
158 | 1 | View Code Duplication | if (null !== $this->internationalBankAccount['swift']) { |
159 | 1 | $data['international_bank_account']['swift'] = $this->internationalBankAccount['swift']; |
|
160 | } |
||
161 | } |
||
162 | |||
163 | 1 | return $data; |
|
164 | } |
||
165 | } |
||
166 |
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.
To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.
The function can be called with either null or an array for the parameter
$needle
but will only accept an array as$haystack
.