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

CallBackCondition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canApply() 0 3 1
A __construct() 0 3 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
}