Completed
Push — master ( 667ec9...454d67 )
by Dominik
01:49
created

Resolver::findBy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 5
1
<?php
2
3
namespace Chubbyphp\Model;
4
5
final class Resolver implements ResolverInterface
6
{
7
    /**
8
     * @param RepositoryInterface $repository
9
     * @param string              $id
10
     *
11
     * @return \Closure
12
     */
13
    public function find(RepositoryInterface $repository, string $id): \Closure
14
    {
15
        return function () use ($repository, $id) {
16
            return $repository->find($id);
17
        };
18
    }
19
20
    /**
21
     * @param RepositoryInterface $repository
22
     * @param array               $criteria
23
     *
24
     * @return \Closure
25
     */
26
    public function findOneBy(RepositoryInterface $repository, array $criteria): \Closure
27
    {
28
        return function () use ($repository, $criteria) {
29
            return $repository->findOneBy($criteria);
30
        };
31
    }
32
}
33