Test Failed
Push — master ( 1339de...31abcb )
by Vítězslav
02:40
created

Company::getEvidenceURL()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 7
c 1
b 0
f 0
nc 6
nop 1
dl 0
loc 12
rs 9.2
1
<?php
2
/**
3
 * FlexiPeeHP - Objekt Společnosti.
4
 *
5
 * @author     Vítězslav Dvořák <[email protected]>
6
 * @copyright  (C) 2015-2017 Spoje.Net
7
 */
8
9
namespace FlexiPeeHP;
10
11
/**
12
 * Firmy/účetní jednotky
13
 *
14
 * @note Tato položka nemá dostupné položky evidence
15
 */
16
class Company extends FlexiBeeRO
17
{
18
    /**
19
     * Základní namespace pro komunikaci s FlexiBEE.
20
     *
21
     * @var string Jmený prostor datového bloku odpovědi
22
     */
23
    public $nameSpace = 'companies';
24
25
    /**
26
     * Default Line Prefix.
27
     *
28
     * @var string
29
     */
30
    public $prefix = '/c';
31
32
    /**
33
     * Company.
34
     *
35
     * @var string
36
     */
37
    public $evidence = '';
38
39
    /**
40
     * Tato třída nepracuje sezvolenou firmou.
41
     *
42
     * @var string
43
     */
44
    public $company = '';
45
46
    /**
47
     * Vrací základní URL pro užitou evidenci
48
     *
49
     * @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Sestavování URL
50
     * @param string $urlSuffix
51
     */
52
    public function getEvidenceURL($urlSuffix = null)
53
    {
54
        if (is_null($urlSuffix)) {
55
            $urlSuffix = $this->evidence;
56
        }
57
58
        $url = $this->url.$this->prefix;
59
        if (!is_null($urlSuffix)) {
60
            $url .= (($urlSuffix[0] == '.') ? '' : '/').$urlSuffix;
61
        }
62
        return $url;
63
    }
64
65
    /**
66
     * Vrací název evidence použité v odpovědích z FlexiBee
67
     *
68
     * @return string
69
     */
70
    public function getResponseEvidence()
71
    {
72
        return 'company';
73
    }
74
75
    /**
76
     * Parse Raw FlexiBee response in several formats
77
     *
78
     * @param string $responseRaw raw response body
79
     * @param string $format      Raw Response format json|xml|etc
80
     *
81
     * @return array
82
     */
83
    public function rawResponseToArray($responseRaw, $format)
84
    {
85
        $response = [];
0 ignored issues
show
Unused Code introduced by
$response is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
86
        if (strstr($responseRaw, 'winstrom')) {
87
            $nsbackup        = $this->nameSpace;
88
            $this->nameSpace = 'winstrom';
89
            $response        = parent::rawResponseToArray($responseRaw, $format);
90
            $this->nameSpace = $nsbackup;
91
        } else {
92
            $response = parent::rawResponseToArray($responseRaw, $format);
93
        }
94
        return $response;
95
    }
96
}
97