Passed
Pull Request — master (#85)
by
unknown
03:54
created

VariantImagePathResolver   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 6
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitBag\SyliusWishlistPlugin\Resolver;
6
7
use Sylius\Component\Core\Model\ProductVariantInterface;
8
9
final class VariantImagePathResolver implements VariantImagePathResolverInterface
10
{
11
    public function resolve(ProductVariantInterface $variant, string $baseUrl)
12
    {
13
        $imagePath = $variant->getProduct()->getImages()->first()->getPath();
0 ignored issues
show
Bug introduced by
The method getImages() does not exist on Sylius\Component\Product\Model\ProductInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Sylius\Component\Product\Model\Product. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

13
        $imagePath = $variant->getProduct()->/** @scrutinizer ignore-call */ getImages()->first()->getPath();
Loading history...
14
        return $baseUrl.'/media/image/'.$imagePath;
15
    }
16
}