LogicalFactory::buildLogicalStatement()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php namespace Cornford\Logical;
2
3
use Cornford\Logical\Contracts\LogicalFactoryInterface;
4
use Cornford\Logical\Contracts\LogicalStatementInterface;
5
use Cornford\Logical\Logical;
6
use Cornford\Logical\LogicalStatement;
7
8
class LogicalFactory implements LogicalFactoryInterface
9
{
10
    /**
11
     * Build a new Logical object and its dependencies
12
     *
13
     * @param array       $input
14
     * @param string|null $logic
15
     *
16
     * @return \Cornford\Logical\Contracts\LogicalInterface
17
     */
18
    public function build(
19
        array $input = [],
20
        $logic = null
21
    ) {
22
        $logicalStatement = $this->buildLogicalStatement();
23
24
        return $this->buildLogical($input, $logic, $logicalStatement);
25
    }
26
27
    /**
28
     * Build the Logical object
29
     *
30
     * @param array                     $input
31
     * @param string|null               $logic
32
     * @param LogicalStatementInterface $logicStatement
33
     *
34
     * @return \Cornford\Logical\Contracts\LogicalInterface
35
     */
36
    public function buildLogical(
37
        array $input = [],
38
        $logic = null,
39
        LogicalStatementInterface $logicStatement
40
    ) {
41
        return new Logical($input, $logic, $logicStatement);
42
    }
43
44
    /**
45
     * Build a new Logical Statement object
46
     *
47
     * @return \Cornford\Logical\Contracts\LogicalStatementInterface
48
     */
49
    public function buildLogicalStatement()
50
    {
51
        return new LogicalStatement();
52
    }
53
}
54