CurlDriverException::getInfo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
crap 1
1
<?php declare(strict_types = 1);
2
3
namespace SlevomatCsobGateway\Api\Driver;
4
5
use RuntimeException;
6
use SlevomatCsobGateway\Api\ApiClientDriverException;
7
8
class CurlDriverException extends RuntimeException implements ApiClientDriverException
9
{
10
11
	/** @var mixed */
12
	private $info;
13
14
	/**
15
	 * @param resource $handle
16
	 */
17 1
	public function __construct($handle)
18
	{
19 1
		parent::__construct('Request error: ' . curl_error($handle));
20
21 1
		$this->code = curl_errno($handle);
22 1
		$this->info = curl_getinfo($handle);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $this->info is correct as curl_getinfo($handle) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
23 1
	}
24
	/**
25
	 * @see curl_getinfo()
26
	 *
27
	 * @return mixed
28
	 */
29 1
	public function getInfo()
30
	{
31 1
		return $this->info;
32
	}
33
34
}
35