Completed
Push — master ( 20c412...48d54d )
by Vítězslav
05:37
created

Changes   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 40
rs 10
wmc 4
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A enable() 0 5 1
A disable() 0 5 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 Spoje.Net
7
 */
8
9
namespace FlexiPeeHP;
10
11
class Changes extends FlexiBee
12
{
13
    /**
14
     * Evidence užitá objektem.
15
     *
16
     * @var string
17
     */
18
    public $evidence = 'changes';
19
20
    /**
21
     * Povolí oznamování změn
22
     * @return type
23
     */
24
    public function enable()
25
    {
26
        $this->performRequest('changes/enable.xml', 'POST', 'xml');
27
        return $this->lastResponseCode == 200;
28
    }
29
30
    /**
31
     * Zakáže oznamování změn
32
     * @return type
33
     */
34
    public function disable()
35
    {
36
        $this->performRequest('changes/disable.xml', 'POST', 'xml');
37
        return $this->lastResponseCode == 200;
38
    }
39
40
    /**
41
     * Vrátí stav zapnutí ChangesAPI
42
     *
43
     * @return boolan
44
     */
45
    public function getStatus()
46
    {
47
        $status = $this->performRequest('changes/status.xml', 'GET', 'xml');
48
        return (($this->lastResponseCode == 200) && ($status['success'] == 'true'));
49
    }
50
}