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

RelatedPosition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 19
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A render() 0 4 1
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