QueryStringKeyWrapper   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 29
ccs 0
cts 19
cp 0
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setLocalName() 0 4 1
A getQueryString() 0 4 2
A process() 0 12 2
1
<?php
2
3
namespace devtoolboxuk\cerberus\Wrappers;
4
5
class QueryStringKeyWrapper extends Base
6
{
7
8
    private $queryArray = [];
9
10
    public function process()
11
    {
12
        $this->initWrapper($this->setLocalName());
13
14
        $this->getQueryString();
15
16
        list($key) = array_pad(explode('|', $this->getReference()), 1, null);
17
18
        if (isset($this->queryArray[$key])) {
19
            $this->setScore($this->getRealScore());
20
        }
21
        $this->setResult();
22
    }
23
24
    private function setLocalName()
25
    {
26
        $name = str_replace(__NAMESPACE__ . '\\', '', __CLASS__);
27
        return str_replace('Wrapper', '', $name);
28
    }
29
30
    private function getQueryString()
31
    {
32
        if (isset($_SERVER["QUERY_STRING"])) {
33
            parse_str($_SERVER["QUERY_STRING"], $this->queryArray);
34
        }
35
    }
36
37
}