Completed
Push — master ( c28e46...490f4f )
by Paweł
10s
created

CustomBlockContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A nameToDocument() 0 4 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
final class CustomBlockContext implements Context
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 :customBlock
25
     */
26
    public function nameToDocument($name)
27
    {
28
        return $this->repository->findOneBy(['name' => $name]);
29
    }
30
}
31