Completed
Push — master ( 0207b1...f7171f )
by Lukáš
72:17 queued 55:41
created

Execution::enable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 6
loc 6
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Lookyman\Rundeck\Api\Endpoints\System;
5
6
use GuzzleHttp\Promise\PromiseInterface;
7
use Lookyman\Rundeck\Api\Client;
8
use GuzzleHttp\Psr7\Request;
9
10 View Code Duplication
class Execution
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
	/**
13
	 * @var Client
14
	 */
15
	private $client;
16
17
	/**
18
	 * @param Client $client
19
	 */
20
	public function __construct(Client $client)
21
	{
22
		$this->client = $client;
23
	}
24
25
	/**
26
	 * @return PromiseInterface
27
	 */
28
	public function enable(): PromiseInterface
29
	{
30
		return $this->client->getConfiguration()->getGuzzle()->sendAsync(
31
			new Request('POST', $this->client->getConfiguration()->getBaseUri() . '/system/executions/enable')
32
		);
33
	}
34
35
	/**
36
	 * @return PromiseInterface
37
	 */
38
	public function disable(): PromiseInterface
39
	{
40
		return $this->client->getConfiguration()->getGuzzle()->sendAsync(
41
			new Request('POST', $this->client->getConfiguration()->getBaseUri() . '/system/executions/disable')
42
		);
43
	}
44
}
45