Completed
Pull Request — master (#146)
by Łukasz
10:35 queued 06:48
created

ProductReviewerProvider::provide()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sylius\ShopApiPlugin\Provider;
6
7
use Sylius\Component\Core\Model\ProductReviewerInterface;
8
use Webmozart\Assert\Assert;
9
10
final class ProductReviewerProvider implements ProductReviewerProviderInterface
11
{
12
    /**
13
     * @var CustomerProviderInterface
14
     */
15
    private $customerProvider;
16
17
    public function __construct(CustomerProviderInterface $customerProvider)
18
    {
19
        $this->customerProvider = $customerProvider;
20
    }
21
22
    public function provide(string $email): ProductReviewerInterface
23
    {
24
        /** @var ProductReviewerInterface $reviewer */
25
        $reviewer = $this->customerProvider->provide($email);
26
27
        Assert::isInstanceOf($reviewer, ProductReviewerInterface::class);
28
29
        return $reviewer;
30
    }
31
}
32