CallbackResolver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 27
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A find() 0 5 1
1
<?php
2
3
/**
4
 * Copyright (c) Phauthentic (https://github.com/Phauthentic)
5
 *
6
 * Licensed under The MIT License
7
 * For full copyright and license information, please see the LICENSE.txt
8
 * Redistributions of files must retain the above copyright notice.
9
 *
10
 * @copyright     Copyright (c) Phauthentic (https://github.com/Phauthentic)
11
 * @link          https://github.com/Phauthentic
12
 * @license       https://opensource.org/licenses/mit-license.php MIT License
13
 */
14
15
declare(strict_types=1);
16
17
namespace Phauthentic\Authentication\Identifier\Resolver;
18
19
use ArrayAccess;
20
21
/**
22
 * A simple callable resolver that allows a quick implementation of any kind
23
 * of resolver logic
24
 */
25
class CallbackResolver implements ResolverInterface
26
{
27
    /**
28
     * Callable
29
     *
30
     * @var callable
31
     */
32
    protected $callable;
33
34
    /**
35
     * Constructor.
36 4
     *
37
     * @param callable $callable Callable.
38 4
     */
39 4
    public function __construct(callable $callable)
40
    {
41
        $this->callable = $callable;
42
    }
43
44 4
    /**
45
     * {@inheritDoc}
46 4
     */
47
    public function find(array $conditions): ?ArrayAccess
48 4
    {
49
        $callable = $this->callable;
50
51
        return $callable($conditions);
52
    }
53
}
54