Total Complexity | 10 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
5 | class CountryWrapper extends Base |
||
6 | { |
||
7 | |||
8 | private $detected = 0; |
||
9 | |||
10 | public function process() |
||
11 | { |
||
12 | $this->initWrapper($this->setLocalName()); |
||
13 | $this->detect(); |
||
14 | |||
15 | if ($this->detected > 0) { |
||
16 | $this->setScore($this->score); |
||
17 | $this->setResult(); |
||
18 | } |
||
19 | } |
||
20 | |||
21 | private function setLocalName() |
||
22 | { |
||
23 | $name = str_replace(__NAMESPACE__ . '\\', '', __CLASS__); |
||
24 | return str_replace('Wrapper', '', $name); |
||
25 | } |
||
26 | |||
27 | private function detect() |
||
28 | { |
||
29 | $params = $this->getParams(); |
||
30 | |||
31 | if (empty($params)) { |
||
32 | return; |
||
33 | } |
||
34 | |||
35 | foreach ($params as $param) { |
||
36 | if ($param != '') { |
||
37 | $data = explode(":", $param); |
||
38 | if (strpos(strtolower($this->sanitizeReference()), strtolower($data[0])) !== false) { |
||
39 | $this->setRealScore($data); |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param array $data |
||
47 | */ |
||
48 | private function setRealScore($data = []) |
||
54 | } |
||
55 | } |
||
56 | |||
57 | } |