LogicalFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 8 1
A buildLogical() 0 7 1
A buildLogicalStatement() 0 4 1
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