Completed
Push — master ( 4b3a6a...ccebfa )
by Dmitry
04:39
created

src/views/tariff/certificate/view.php (1 issue)

Upgrade to new PHP Analysis Engine

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 hipanel\modules\finance\widgets\PriceDifferenceWidget;
4
use hipanel\widgets\Box;
5
use yii\helpers\Html;
6
7
/**
8
 * @var \yii\web\View
9
 * @var $model \hipanel\modules\finance\forms\CertificateTariffForm
10
 */
11
Box::begin() ?>
12
<div class="row">
13
    <div class="col-md-12">
14
        <table class="table table-condensed">
15
            <thead>
16
            <tr>
17
                <th></th>
18
                <?php foreach ($model->getResourceTypes() as $type) : ?>
19
                    <th style="text-align: center" colspan="<?= count($model->getPeriods()) ?>"><?= $type ?></th>
20
                <?php endforeach; ?>
21
            </tr>
22
            <tr>
23
                <th></th>
24
                <?php foreach ($model->getResourceTypes() as $type) : ?>
25
                    <?php foreach ($model->getPeriods() as $period => $periodLabel) : ?>
26
                        <?= Html::tag('th', $periodLabel); ?>
27
                    <?php endforeach; ?>
28
                <?php endforeach; ?>
29
            </tr>
30
            </thead>
31
            <tbody>
32
            <?php $i = 0; ?>
33
            <?php foreach ($model->getCertificateTypes() as $id => $certificateType) : ?>
34
                <tr>
35
                    <td><?= $certificateType ?></td>
36
                    <?php foreach ($model->getTypeResources($certificateType) as $type => $resource) : ?>
37
                        <?php /** @var \hipanel\modules\finance\models\CertificateResource $resource */ ?>
38
                        <?php $baseResources = $model->getTypeParentResources($certificateType); ?>
39
                        <?php foreach ($model->getPeriods() as $period => $periodLabel) : ?>
40
                            <td>
41
                                <div class="row">
42
                                    <?php $price = $resource->getPriceForPeriod($period) ?>
43
                                    <?php $textc = $price > 0 ? '' : ' text-warning' ?>
44
                                    <div class="col-md-6 <?= $textc ?>">
45
                                        <?= \hipanel\modules\finance\widgets\ResourcePriceWidget::widget([
46
                                            'price' => $price,
47
                                            'currency' => $resource->currency,
0 ignored issues
show
The property currency does not exist on object<hipanel\modules\f...ls\CertificateResource>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
48
                                        ]) ?>
49
                                    </div>
50
                                    <div class="col-md-6">
51
                                        <?= PriceDifferenceWidget::widget([
52
                                            'new' => $resource->getPriceForPeriod($period),
53
                                            'old' => $baseResources[$type]->getPriceForPeriod($period),
54
                                        ]) ?>
55
                                    </div>
56
                                </div>
57
                            </td>
58
                        <?php endforeach; ?>
59
                        <?php ++$i; ?>
60
                    <?php endforeach; ?>
61
                </tr>
62
            <?php endforeach; ?>
63
            </tbody>
64
        </table>
65
    </div>
66
</div>
67
<?php Box::end() ?>
68