Completed
Pull Request — master (#20)
by Klochok
14:26
created

RelatedPosition::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace hiqdev\yii2\cart;
4
5
use yii\base\Widget;
6
use hiqdev\yii2\cart\ShoppingCart;
7
use Yii;
8
9
class RelatedPosition implements RelatedPositionInterface
10
{
11
    /** @var Widget */
12
    public $widget;
13
14
    /** @inheritDoc */
15
    public function configure($type, array $params = []): RelatedPositionInterface
16
    {
17
        $this->widget = Yii::createObject($type, $params);
18
19
        return $this;
20
    }
21
22
    /** @inheritDoc */
23
    public function render(): string
24
    {
25
        return $this->widget->run();
26
    }
27
}
28