Completed
Branch conditions-refactoring (e50fd3)
by Romain
02:01
created

ConditionTree::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
/*
3
 * 2016 Romain CANON <[email protected]>
4
 *
5
 * This file is part of the TYPO3 Formz project.
6
 * It is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU General Public License, either
8
 * version 3 of the License, or any later version.
9
 *
10
 * For the full copyright and license information, see:
11
 * http://www.gnu.org/licenses/gpl-3.0.html
12
 */
13
14
namespace Romm\Formz\Condition\Parser;
15
16
use Romm\Formz\Condition\Parser\Node\NodeInterface;
17
use Romm\Formz\Condition\Processor\ConditionProcessor;
18
use TYPO3\CMS\Extbase\Error\Result;
19
20
/**
21
 * @todo
22
 */
23
class ConditionTree
24
{
25
    /**
26
     * @var NodeInterface
27
     */
28
    private $rootNode;
29
30
    /**
31
     * @var Result
32
     */
33
    private $result;
34
35
    /**
36
     * @var ConditionProcessor
37
     */
38
    private $conditionProcessor;
39
40
    /**
41
     * @param NodeInterface $rootNode
42
     * @param Result        $result
43
     */
44
    public function __construct(NodeInterface $rootNode, Result $result)
45
    {
46
        $this->rootNode = $rootNode;
47
        $this->result = $result;
48
    }
49
50
    /**
51
     * @param ConditionProcessor $conditionProcessor
52
     * @return $this
53
     */
54
    public function attachConditionProcessor(ConditionProcessor $conditionProcessor)
55
    {
56
        $this->conditionProcessor = $conditionProcessor;
57
58
        return $this;
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    public function getCssConditions()
65
    {
66
        return $this->rootNode->getCssResult();
67
    }
68
69
    /**
70
     * @return array
71
     */
72
    public function getJavaScriptConditions()
73
    {
74
        return $this->rootNode->getJavaScriptResult();
75
    }
76
77
    /**
78
     * @return bool
79
     */
80
    public function getPhp()
81
    {
82
        return $this->rootNode->getPhpResult();
83
    }
84
85
    /**
86
     * @return Result
87
     */
88
    public function getResult()
89
    {
90
        return $this->result;
91
    }
92
}
93