EventLog   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 4
dl 0
loc 42
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 11 2
A getDetailedLog() 0 11 2
A getLastId() 0 4 1
1
<?php
2
// Copyright 1999-2021. Plesk International GmbH.
3
4
namespace PleskX\Api\Operator;
5
6
use PleskX\Api\Struct\EventLog as Struct;
7
8
class EventLog extends \PleskX\Api\Operator
9
{
10
    protected $_wrapperTag = 'event_log';
11
12
    /**
13
     * @return Struct\Event[]
14
     */
15
    public function get()
16
    {
17
        $records = [];
18
        $response = $this->request('get');
19
20
        foreach ($response->event as $eventInfo) {
21
            $records[] = new Struct\Event($eventInfo);
22
        }
23
24
        return $records;
25
    }
26
27
    /**
28
     * @return Struct\DetailedEvent[]
29
     */
30
    public function getDetailedLog()
31
    {
32
        $records = [];
33
        $response = $this->request('get_events');
34
35
        foreach ($response->event as $eventInfo) {
36
            $records[] = new Struct\DetailedEvent($eventInfo);
37
        }
38
39
        return $records;
40
    }
41
42
    /**
43
     * @return int
44
     */
45
    public function getLastId()
46
    {
47
        return (int) $this->request('get-last-id')->getValue('id');
48
    }
49
}
50