Changes   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 8
eloc 14
dl 0
loc 85
c 0
b 0
f 0
rs 10
ccs 10
cts 20
cp 0.5

7 Methods

Rating   Name   Duplication   Size   Complexity  
A recordExists() 0 3 1
A disable() 0 4 1
A enable() 0 4 1
A getVazby() 0 3 1
A getGlobalVersion() 0 4 1
A rawXmlToArray() 0 3 1
A getStatus() 0 5 2
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
25
    /**
26
     * Povolí oznamování změn
27
     * @return type
0 ignored issues
show
Bug introduced by
The type FlexiPeeHP\type was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
     */
29 1
    public function enable()
30
    {
31 1
        $this->performRequest('enable.xml', 'POST', 'xml');
32
        return $this->lastResponseCode == 200;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->lastResponseCode == 200 returns the type boolean which is incompatible with the documented return type FlexiPeeHP\type.
Loading history...
33
    }
34
35
    /**
36
     * Zakáže oznamování změn
37
     * @return type
38
     */
39 1
    public function disable()
40
    {
41 1
        $this->performRequest('disable.xml', 'POST', 'xml');
42
        return $this->lastResponseCode == 200;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->lastResponseCode == 200 returns the type boolean which is incompatible with the documented return type FlexiPeeHP\type.
Loading history...
43
    }
44
45
    /**
46
     * Vrátí stav zapnutí ChangesAPI
47
     *
48
     * @return boolan
0 ignored issues
show
Bug introduced by
The type FlexiPeeHP\boolan was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
49
     */
50 1
    public function getStatus()
51
    {
52 1
        $status = $this->performRequest('status.xml', 'GET', 'xml');
53 1
        return (($this->lastResponseCode == 200) && ($status['changes'][0]['success']
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->lastRespon...]['success'] === 'true' returns the type boolean which is incompatible with the documented return type FlexiPeeHP\boolan.
Loading history...
54 1
            === 'true'));
55
    }
56
57
    /**
58
     * Test if given record exists in FlexiBee .
59
     *
60
     * @param array $data
61
     * @return null Method is disabled for Changes
62
     */
63 1
    public function recordExists($data = null)
64
    {
65 1
        return null;
66
    }
67
68
    /**
69
     * Obtain actual GlobalVersion
70
     * Vrací aktuální globální verzi změn
71
     *
72
     * @link https://www.flexibee.eu/api/dokumentace/ref/changes-api#globalVersion Globální Verze
73
     * @return int
74
     */
75
    public function getGlobalVersion()
76
    {
77
        $this->getColumnsFromFlexibee('id', ['start' => 0, 'limit' => 0]);
0 ignored issues
show
Bug introduced by
'id' of type string is incompatible with the type string[] expected by parameter $columnsList of FlexiPeeHP\FlexiBeeRO::getColumnsFromFlexibee(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

77
        $this->getColumnsFromFlexibee(/** @scrutinizer ignore-type */ 'id', ['start' => 0, 'limit' => 0]);
Loading history...
78
        return $this->globalVersion;
79
    }
80
81
    /**
82
     * Convert FlexiBee Response XML to Array
83
     *
84
     * @param string $rawXML
85
     *
86
     * @return array
87
     */
88
    public function rawXmlToArray($rawXML)
89
    {
90
        return [$this->getEvidence() => parent::rawXmlToArray($rawXML)];
91
    }
92
93
    /**
94
     * Changes has no relations
95
     *
96
     * @return null
97
     */
98
    public function getVazby($id = null)
99
    {
100
        throw new \Exception(_('Changes has no relations'));
101
    }
102
}
103