Completed
Push — master ( f2b0ce...6a806c )
by Akram
02:02
created

Job::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Rundeck\Resources;
4
5
use Rundeck\HttpClient;
6
7
/**
8
 * Class Job
9
 * @package Rundeck\Resources
10
 */
11
class Job extends Resource
12
{
13
14
    /**
15
     * @var array
16
     */
17
    protected $actions = [
18
        "executions" => ["xml"],
19
        "input/files" => ["xml"],
20
        "info" => ["xml"],
21
    ];
22
23
    /**
24
     * @param HttpClient $client
25
     * @param string $name
26
     */
27 6
    public function __construct(HttpClient $client, $name = null)
28
    {
29 6
        $this->name = $name;
30 6
        $this->client = $client;
31 6
    }
32
33
    /**
34
     * @param string $alt
35
     * @return mixed
36
     */
37 3
    public function find($alt = "xml")
38
    {
39 3
        $response = $this->client->get('/job/'.$this->name, $alt);
40 3
        return $response;
41
    }
42
43
44
    /**
45
     * @param string $alt
46
     * @return mixed
47
     */
48
    public function run($alt = "xml")
49
    {
50
        $response = $this->client->post('/job/'.$this->name, $alt);
51
        return $response;
52
    }
53
}
54