Completed
Branch conditions-refactoring (4b1dba)
by Romain
03:17
created

ConditionTree::getJavaScriptConditions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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;
15
16
use Romm\Formz\Condition\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
     */
53
    public function attachConditionProcessor(ConditionProcessor $conditionProcessor)
54
    {
55
        $this->conditionProcessor = $conditionProcessor;
56
    }
57
58
    /**
59
     * @return array
60
     */
61
    public function getCssConditions()
62
    {
63
        return $this->rootNode->getCssResult();
64
    }
65
66
    /**
67
     * @return array
68
     */
69
    public function getJavaScriptConditions()
70
    {
71
        return $this->rootNode->getJavaScriptResult();
72
    }
73
74
    /**
75
     * @return bool
76
     */
77
    public function getPhp()
78
    {
79
        return $this->rootNode->getPhpResult();
80
    }
81
82
    /**
83
     * @return Result
84
     */
85
    public function getResult()
86
    {
87
        return $this->result;
88
    }
89
}
90