CallBackCondition::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
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
use Doctrine\DBAL\Schema\Column;
5
use Doctrine\DBAL\Schema\Table;
6
use Doctrine\DBAL\Types\Type;
7
8
class CallBackCondition implements ConditionInterface
9
{
10
11
    /**
12
     * @var callable
13
     */
14
    private $callback;
15
16
    /**
17
     * CheckTypeCondition constructor.
18
     * @param callable $callback
19
     */
20
    public function __construct(callable $callback)
21
    {
22
        $this->callback = $callback;
23
    }
24
25
    /**
26
     * @param Table $table
27
     * @param Column $column
28
     * @return bool : if the Generator will be applied
29
     */
30
    public function canApply(Table $table, Column $column) : bool
31
    {
32
        return \call_user_func($this->callback, $table, $column);
33
    }
34
}
35