Test Failed
Push — master ( eced33...28436f )
by Vítězslav
06:44
created

Changes::getGlobalVersion()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 7
ccs 0
cts 0
cp 0
crap 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * FlexiPeeHP - Objekt záznamu změn.
4
 *
5
 * @author     Vítězslav Dvořák <[email protected]>
6
 * @copyright  (C) 2016-2017 Spoje.Net
7
 */
8
9
namespace FlexiPeeHP;
10
11
/**
12
 * Log změn v evidencích
13
 *
14
 * @link https://www.flexibee.eu/api/dokumentace/ref/changes-api/ Dokumentace
15
 */
16
class Changes extends FlexiBeeRO
17
{
18
    /**
19
     * Evidence užitá objektem.
20
     *
21
     * @var string
22
     */
23
    public $evidence = 'changes';
24 1
25
    /**
26 1
     * Povolí oznamování změn
27 1
     * @return type
28
     */
29
    public function enable()
30
    {
31
        $this->performRequest('enable.xml', 'POST', 'xml');
32
        return $this->lastResponseCode == 200;
33
    }
34 1
35
    /**
36 1
     * Zakáže oznamování změn
37 1
     * @return type
38
     */
39
    public function disable()
40
    {
41
        $this->performRequest('disable.xml', 'POST', 'xml');
42
        return $this->lastResponseCode == 200;
43
    }
44
45 1
    /**
46
     * Vrátí stav zapnutí ChangesAPI
47 1
     *
48 1
     * @return boolan
49
     */
50
    public function getStatus()
51
    {
52
        $status = $this->performRequest('status.xml', 'GET', 'xml');
53
        return (($this->lastResponseCode == 200) && ($status['success'] === 'true'));
54
    }
55
56
    /**
57
     * Test if given record exists in FlexiBee .
58
     *
59
     * @param array $data
60
     * @return null Method is disabled for Changes
61
     */
62
    public function recordExists($data = null)
63
    {
64
        return null;
65
    }
66
67
    /**
68
     * Obtain actual GlobalVersion
69
     * Vrací aktuální globální verzi změn
70
     *
71
     * @link https://www.flexibee.eu/api/dokumentace/ref/changes-api#globalVersion Globální Verze
72
     * @return int
73
     */
74
    public function getGlobalVersion()
75
    {
76
        $this->getColumnsFromFlexibee('*', ['start' => 0, 'limit' => 0]);
0 ignored issues
show
Documentation introduced by
'*' is of type string, but the function expects a array<integer,string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
77
        $globalVersionRaw = json_decode($this->lastCurlResponse, TRUE);
78
        return isset($globalVersionRaw[$this->nameSpace]['@globalVersion']) ? intval($globalVersionRaw[$this->nameSpace]['@globalVersion'])
79
                : null;
80
    }
81
}
82