1 | <?php |
||
7 | abstract class Wrapper |
||
8 | { |
||
9 | |||
10 | private $options = []; |
||
11 | private $results = null; |
||
12 | private $score = 0; |
||
13 | private $realScore = 0; |
||
14 | private $params = []; |
||
15 | private $name; |
||
16 | private $active; |
||
17 | private $reference; |
||
18 | |||
19 | protected $soteria; |
||
20 | |||
21 | 4 | function __construct() |
|
25 | |||
26 | function pushResult($result) |
||
30 | |||
31 | 4 | function getResult() |
|
35 | |||
36 | 2 | public function getRealScore() |
|
37 | { |
||
38 | 2 | if (!$this->hasRealScore()) { |
|
39 | return 0; |
||
40 | } |
||
41 | |||
42 | 2 | return $this->realScore; |
|
43 | } |
||
44 | |||
45 | 2 | private function hasRealScore() |
|
49 | |||
50 | 4 | function setOptions($reference, $options = []) |
|
56 | |||
57 | function sanitizeReference() |
||
61 | |||
62 | |||
63 | 4 | function getReference() |
|
67 | |||
68 | protected function setReference($reference) |
||
73 | |||
74 | public function inParams($name) |
||
81 | |||
82 | protected function getParams() |
||
86 | |||
87 | 4 | protected function setParams($params) |
|
92 | |||
93 | public function getRuleOption($name, $score) |
||
101 | |||
102 | public function hasRuleOption($name) |
||
106 | |||
107 | 4 | protected function initWrapper($name) |
|
112 | |||
113 | 4 | function setRules() |
|
121 | |||
122 | 4 | public function getOption($name) |
|
130 | |||
131 | 4 | public function hasOption($name) |
|
135 | |||
136 | 4 | function getName() |
|
140 | |||
141 | 4 | protected function setName($name) |
|
146 | |||
147 | 4 | private function setRealScore($score) |
|
151 | |||
152 | 4 | private function setActive($active) |
|
156 | |||
157 | 2 | protected function setResult() |
|
158 | { |
||
159 | 2 | if ($this->getActive()) { |
|
160 | 2 | $this->results[$this->getName()] = $this->getScore(); |
|
161 | 2 | $this->score = $this->getScore(); |
|
162 | } else { |
||
163 | $this->score = 0; |
||
164 | } |
||
165 | 2 | return $this; |
|
166 | } |
||
167 | |||
168 | 2 | private function getActive() |
|
172 | |||
173 | 4 | public function getScore() |
|
181 | |||
182 | 2 | protected function setScore($score) |
|
186 | |||
187 | 4 | private function hasScore() |
|
191 | |||
192 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.