Completed
Push — master ( cc864c...f8b489 )
by Akram
02:32
created

System::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 9
ccs 0
cts 9
cp 0
rs 9.6666
cc 2
eloc 6
nc 2
nop 2
crap 6
1
<?php
2
3
namespace Rundeck\Resources;
4
5
use Rundeck\HttpClient;
6
7
class System
8
{
9
    private $name;
10
    private $client;
11
12
    private $actions = [
13
        "info",
14
        "logstorage",
15
        "logstorage/incomplete"
16
    ];
17
18
    public function __construct(HttpClient $client, $name = null)
19
    {
20
        $this->name = $name;
21
        $this->client = $client;
22
    }
23
24
    public function get($action, $alt = "xml")
25
    {
26
        if (in_array($action, $this->actions)) {
27
            $response = $this->client->get('/system/'. $action, $alt);
28
            return $response;
29
        } else {
30
            throw new \Exception("Action invalid.");
31
        }
32
    }
33
}
34