CurlDriverException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
dl 0
loc 24
rs 10
c 1
b 0
f 0
ccs 7
cts 7
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getInfo() 0 3 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