Passed
Push — master ( 454cf7...0d52c3 )
by Kacper
02:57
created

DelegateValidator::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
ccs 3
cts 3
cp 1
cc 2
eloc 3
nc 2
nop 2
crap 2
1
<?php
2
/**
3
 * Highlighter
4
 *
5
 * Copyright (C) 2016, Some right reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Highlighter\Parser\Validator;
17
18
19
class DelegateValidator extends Validator
20
{
21
    /**
22
     * @var callable
23
     */
24
    private $_callable;
25
26
    /**
27
     * DelegateValidator constructor.
28
     *
29
     * @param callable $callable
30
     */
31 3
    public function __construct(callable $callable)
32
    {
33 3
        $this->_callable = $callable;
34 3
    }
35
36 14
    public function validate(array $context, $additional = [])
37
    {
38 14
        $callable = $this->_callable;
39 14
        return $callable($context) && parent::validate($context, $additional);
40
    }
41
}