Completed
Push — master ( adc131...6e9eb4 )
by Kevin
03:32
created

CallBackCondition::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
namespace DBFaker\Generators\Conditions;
3
4
5
use Doctrine\DBAL\Schema\Column;
6
use Doctrine\DBAL\Schema\Table;
7
use Doctrine\DBAL\Types\Type;
8
9
class CallBackCondition implements ConditionInterface
10
{
11
12
    /**
13
     * @var callable
14
     */
15
    private $callback;
16
17
    /**
18
     * CheckTypeCondition constructor.
19
     * @param callable $callback
20
     */
21
    public function __construct(callable $callback)
22
    {
23
        $this->callback = $callback;
24
    }
25
26
    /**
27
     * @param Table $table
28
     * @param Column $column
29
     * @return bool : if the Generator will be applied
30
     */
31
    public function canApply(Table $table, Column $column) : bool
32
    {
33
        return \call_user_func($this->callback, $table, $column);
34
    }
35
}