Completed
Push — 1.2-symfony-4.1 ( b0b494...78eb0c )
by Kamil
19:24
created

CustomBookRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 20
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findCustomBook() 0 4 1
A findCustomBooks() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AppBundle\Repository;
6
7
use AppBundle\Entity\Book;
8
use Sylius\Component\Resource\Repository\RepositoryInterface;
9
10
final class CustomBookRepository
11
{
12
    /** @var RepositoryInterface */
13
    private $repository;
14
15
    public function __construct(RepositoryInterface $repository)
16
    {
17
        $this->repository = $repository;
18
    }
19
20
    public function findCustomBook(string $author): ?Book
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
21
    {
22
        return $this->repository->findOneBy(['author' => $author]);
23
    }
24
25
    public function findCustomBooks(): iterable
26
    {
27
        return $this->repository->createPaginator();
28
    }
29
}
30