Completed
Push — master ( be3b1d...2883bd )
by Lukáš
03:28 queued 01:31
created

Job::export()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Lookyman\Rundeck\Api\Endpoints\Project;
5
6
use GuzzleHttp\Promise\PromiseInterface;
7
use GuzzleHttp\Psr7\Request;
8
use Lookyman\Rundeck\Api\Client;
9
10
class Job
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
	 * @param string $project
27
	 * @param array $params
28
	 * @return PromiseInterface
29
	 */
30
	public function list(string $project, array $params = []): PromiseInterface
31
	{
32
		return $this->client->getConfiguration()->getGuzzle()->sendAsync(
33
			new Request('GET', $this->client->getConfiguration()->getBaseUri() . sprintf('/project/%s/jobs', urlencode($project)), [], $this->client->getConfiguration()->getFormat()->formatParams($params))
34
		);
35
	}
36
37
	/**
38
	 * @param string $project
39
	 * @param array $params
40
	 * @return PromiseInterface
41
	 */
42
	public function export(string $project, array $params = []): PromiseInterface
43
	{
44
		return $this->client->getConfiguration()->getGuzzle()->sendAsync(
45
			new Request('GET', $this->client->getConfiguration()->getBaseUri() . sprintf('/project/%s/jobs/export', urlencode($project)), $this->client->getConfiguration()->getFormat()->formatParams($params))
0 ignored issues
show
Documentation introduced by
$this->client->getConfig...->formatParams($params) is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
46
		);
47
	}
48
49
	/**
50
	 * @return PromiseInterface
51
	 */
52
	public function import(): PromiseInterface
53
	{
54
		throw new \LogicException('Not implemented');
55
	}
56
}
57