Completed
Pull Request — master (#25)
by Kamil
03:01
created

ProductBlockContext::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Lakion\SyliusCmsBundle\Tests\Behat\Context\Transform;
4
5
use Behat\Behat\Context\Context;
6
use Sylius\Component\Resource\Repository\RepositoryInterface;
7
8 View Code Duplication
final class ProductBlockContext implements Context
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var RepositoryInterface
12
     */
13
    private $repository;
14
15
    /**
16
     * @param RepositoryInterface $repository
17
     */
18
    public function __construct(RepositoryInterface $repository)
19
    {
20
        $this->repository = $repository;
21
    }
22
23
    /**
24
     * @Transform :productBlock
25
     */
26
    public function nameToDocument($name)
27
    {
28
        return $this->repository->findOneBy(['name' => $name]);
29
    }
30
}
31