Completed
Pull Request — master (#188)
by Kamil
03:23
created

PriceViewFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Sylius\ShopApiPlugin\Factory;
4
5
use Sylius\ShopApiPlugin\View\PriceView;
6
7
final class PriceViewFactory implements PriceViewFactoryInterface
8
{
9
    /** @var string */
10
    private $priceViewClass;
11
12
    public function __construct(string $priceViewClass)
13
    {
14
        $this->priceViewClass = $priceViewClass;
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function create(int $price): PriceView
21
    {
22
        /** @var PriceView $priceView */
23
        $priceView = new $this->priceViewClass();
24
        $priceView->current = $price;
25
26
        return $priceView;
27
    }
28
}
29