Completed
Push — master ( 13ee85...192638 )
by Ivannis Suárez
02:46
created

Custom::acceptComparatorVisitor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Cubiche\Core\Comparable;
12
13
use Cubiche\Core\Delegate\Delegate;
14
15
/**
16
 * Custom Comparator Class.
17
 *
18
 * @author Karel Osorio Ramírez <[email protected]>
19
 */
20
class Custom extends AbstractComparator
21
{
22
    /**
23
     * @var Delegate
24
     */
25
    protected $delegate;
26
27
    /**
28
     * @param callable $callable
29
     */
30
    public function __construct(callable $callable)
31
    {
32
        $this->delegate = new Delegate($callable);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function compare($a, $b)
39
    {
40
        return $this->delegate->__invoke($a, $b);
41
    }
42
}
43