Passed
Pull Request — master (#24)
by
unknown
05:05
created

Orders   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A printDocument() 0 10 2
1
<?php
2
3
namespace Daaner\NovaPoshta\Models;
4
5
use Daaner\NovaPoshta\NovaPoshta;
6
7
class Orders extends NovaPoshta
8
{
9
    protected $model = 'orders';
10
    protected $calledMethod;
11
    protected $methodProperties = null;
12
13
	/**
14
	 * printDocument method of InternetDocument model.
15
	 *
16
	 * @param array|string $DocumentRefs Array of Documents IDs
17
	 * @param string       $type         (pdf|html)
18
	 *
19
	 * @return mixed
20
	 */
21
	public function printDocument($DocumentRefs, $type = 'html')
22
	{
23
		if (is_array($DocumentRefs) === false) {
24
			$DocumentRefs = explode(', ', /** @scrutinizer ignore-type */ $DocumentRefs);
25
		}
26
27
		$orders = "orders[]/" . implode("/orders[]/", $DocumentRefs);
0 ignored issues
show
Bug introduced by
It seems like $DocumentRefs can also be of type string; however, parameter $pieces of implode() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

27
		$orders = "orders[]/" . implode("/orders[]/", /** @scrutinizer ignore-type */ $DocumentRefs);
Loading history...
28
		$this->calledMethod = 'printDocument/' . $orders . '/type/' . $type . '/apiKey/' . $this->getApi();
29
30
		return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties);
31
	}
32
}
33