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 | use yii\helpers\Html; |
||
4 | |||
5 | /** |
||
6 | * @var \yii\web\View |
||
7 | * @var \hipanel\modules\finance\cart\AbstractPurchase[] $success |
||
8 | * @var \hipanel\modules\finance\cart\ErrorPurchaseException[] $error |
||
9 | * @var \hipanel\modules\finance\cart\PendingPurchaseException[] $pending |
||
10 | * @var array $remarks |
||
11 | * @var float $balance |
||
12 | * @var string $currency |
||
13 | */ |
||
14 | |||
15 | $this->title = Yii::t('cart', 'Order execution'); |
||
16 | |||
17 | ?> |
||
18 | |||
19 | <div class="cart-finish"> |
||
20 | |||
21 | <?php if (!empty($error)) : ?> |
||
22 | <div class="row"> |
||
23 | <div class="col-md-12"> |
||
24 | <div class="box box-danger box-solid"> |
||
25 | <div class="box-header with-border"> |
||
26 | <?= Html::tag('h3', '<i class="fa fa-exclamation-triangle"></i> ' . Yii::t('cart', 'Operations failed') . ': ' . Yii::t('cart', '{0, plural, one{# position} other{# positions}}', count($error))); ?> |
||
27 | </div> |
||
28 | <div class="box-body"> |
||
29 | <table class="table table-striped"> |
||
30 | <thead> |
||
31 | <tr> |
||
32 | <th class="text-center">#</th> |
||
33 | <th><?= Yii::t('cart', 'Description') ?></th> |
||
34 | <th class="text-right"><?= Yii::t('cart', 'Price') ?></th> |
||
35 | <th></th> |
||
36 | </tr> |
||
37 | </thead> |
||
38 | <tbody> |
||
39 | <?php |
||
40 | $no = 1; |
||
41 | foreach ($error as $exception) : |
||
42 | $item = $exception->position; |
||
43 | ?> |
||
44 | <tr> |
||
45 | <td class="text-center text-bold"><?= $no++ ?></td> |
||
46 | <td> |
||
47 | <?= $item->renderDescription() ?><br> |
||
48 | <?= Html::tag('p', $exception->getMessage(), ['class' => 'bg-danger', 'style' => 'padding: 1em;']) ?> |
||
49 | </td> |
||
50 | <td align="right" |
||
51 | class="text-bold"><?= Yii::$app->formatter->asCurrency($item->cost, $item->getCurrency()) ?></td> |
||
52 | <td></td> |
||
53 | </tr> |
||
54 | <?php endforeach; ?> |
||
55 | </tbody> |
||
56 | </table> |
||
57 | </div> |
||
58 | </div> |
||
59 | </div> |
||
60 | </div> |
||
61 | <?php endif; ?> |
||
62 | |||
63 | |||
64 | <?php if (!empty($pending)) : ?> |
||
65 | <div class="row"> |
||
66 | <div class="col-md-12"> |
||
67 | <div class="box box-warning box-solid"> |
||
68 | <div class="box-header with-border"> |
||
69 | <?= Html::tag('h3', '<i class="fa fa-exclamation-triangle"></i> ' . Yii::t('cart', 'Pending operations') . ': ' . Yii::t('cart', '{0, plural, one{# position} other{# positions}}', count($pending))); ?> |
||
0 ignored issues
–
show
|
|||
70 | </div> |
||
71 | <div class="box-body"> |
||
72 | <table class="table table-striped"> |
||
73 | <thead> |
||
74 | <tr> |
||
75 | <th class="text-center">#</th> |
||
76 | <th><?= Yii::t('cart', 'Description') ?></th> |
||
77 | <th class="text-right"><?= Yii::t('cart', 'Price') ?></th> |
||
78 | <th></th> |
||
79 | </tr> |
||
80 | </thead> |
||
81 | <tbody> |
||
82 | <?php |
||
83 | $no = 1; |
||
84 | View Code Duplication | foreach ($pending as $exception) : |
|
0 ignored issues
–
show
This code seems to be duplicated across 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...
|
|||
85 | $item = $exception->position; |
||
86 | ?> |
||
87 | <tr> |
||
88 | <td class="text-center text-bold"><?= $no++ ?></td> |
||
89 | <td> |
||
90 | <?= $item->renderDescription() ?><br> |
||
91 | <?= $exception->getMessage() ?> |
||
92 | </td> |
||
93 | <td align="right" |
||
94 | class="text-bold"><?= Yii::$app->formatter->asCurrency($item->cost, $item->getCurrency()) ?></td> |
||
95 | <td></td> |
||
96 | </tr> |
||
97 | <?php endforeach; ?> |
||
98 | </tbody> |
||
99 | </table> |
||
100 | </div> |
||
101 | </div> |
||
102 | </div> |
||
103 | </div> |
||
104 | <?php endif; ?> |
||
105 | |||
106 | <?php if (count($success)) : ?> |
||
107 | <div class="row"> |
||
108 | <div class="col-md-12"> |
||
109 | <div class="box box-success"> |
||
110 | <div class="box-header with-border"> |
||
111 | <h3 class="box-title"> |
||
112 | <?= Yii::t('cart', 'Operations performed') ?> |
||
113 | : <?= Yii::t('cart', '{0, plural, one{# position} other{# positions}}', count($success)) ?> |
||
0 ignored issues
–
show
count($success) is of type integer , but the function expects a array .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
114 | </h3> |
||
115 | </div> |
||
116 | <div class="box-body"> |
||
117 | <table class="table table-striped"> |
||
118 | <thead> |
||
119 | <tr> |
||
120 | <th class="text-center">#</th> |
||
121 | <th><?= Yii::t('cart', 'Description') ?></th> |
||
122 | <th><?= Yii::t('cart', 'Notes') ?></th> |
||
123 | <th class="text-right"><?= Yii::t('cart', 'Price') ?></th> |
||
124 | <th></th> |
||
125 | </tr> |
||
126 | </thead> |
||
127 | <tbody> |
||
128 | <?php $no = 1 ?> |
||
129 | View Code Duplication | <?php foreach ($success as $purchase) : ?> |
|
0 ignored issues
–
show
This code seems to be duplicated across 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...
|
|||
130 | <?php $item = $purchase->position ?> |
||
131 | <tr> |
||
132 | <td class="text-center text-bold"><?= $no++ ?></td> |
||
133 | <td><?= $item->renderDescription() ?></td> |
||
134 | <td><?= $purchase->renderNotes() ?></td> |
||
135 | <td align="right" |
||
136 | class="text-bold"><?= Yii::$app->formatter->asCurrency($item->cost, $item->getCurrency()) ?></td> |
||
137 | <td></td> |
||
138 | </tr> |
||
139 | <?php endforeach; ?> |
||
140 | </tbody> |
||
141 | </table> |
||
142 | </div> |
||
143 | </div> |
||
144 | </div> |
||
145 | </div> |
||
146 | <?php endif ?> |
||
147 | |||
148 | <div class="row"> |
||
149 | <div class="col-md-12"> |
||
150 | <div class="box box-solid"> |
||
151 | <div class="box-header with-border"> |
||
152 | <h3 class="box-title"> |
||
153 | <?= Yii::t('hipanel:finance', 'Your balance after all operations: {amount}', [ |
||
154 | 'amount' => Yii::$app->formatter->asCurrency($balance, $currency), |
||
155 | ]) ?> |
||
156 | </h3> |
||
157 | </div> |
||
158 | <div class="box-body text-center"> |
||
159 | <p class="text-muted well well-sm no-shadow"> |
||
160 | <?php |
||
161 | if (Yii::$app->user->isGuest) { |
||
162 | echo Yii::t('hipanel:finance', 'If you have any further questions, please, contact us {emailLink}', [ |
||
163 | 'emailLink' => Html::mailto(Yii::$app->params['supportEmail'], Yii::$app->params['supportEmail']), |
||
164 | ]); |
||
165 | } else { |
||
166 | echo Yii::t('hipanel:finance', 'If you have any further questions, please, {ticketCreationLink}.', [ |
||
167 | 'ticketCreationLink' => Html::a(Yii::t('hipanel:finance', 'create a ticket'), '@ticket/create'), |
||
168 | ]); |
||
169 | } ?> |
||
170 | </p> |
||
171 | </div> |
||
172 | </div> |
||
173 | </div> |
||
174 | </div> |
||
175 | |||
176 | <?php if (count($remarks)) : ?> |
||
177 | <?php foreach ($remarks as $remark) : ?> |
||
178 | <?= $remark ?> |
||
179 | <?php endforeach ?> |
||
180 | <?php endif ?> |
||
181 | |||
182 | </div> |
||
183 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: