Completed
Push — master ( 9a8fc2...1b152a )
by Jeroen van
13s queued 11s
created

CurlException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 1
A getInfo() 0 4 1
1
<?php
2
3
namespace VCR\Util;
4
5
class CurlException extends \Exception
6
{
7
    /**
8
     * @var array<string,mixed>
9
     */
10
    private $info;
11
12
    /**
13
     * @param resource $ch The cURL handler
14
     *
15
     * @return CurlException
16
     */
17
    public static function create($ch): self
18
    {
19
        $e = new self(curl_error($ch), curl_errno($ch));
20
        $e->info = curl_getinfo($ch);
0 ignored issues
show
Documentation Bug introduced by
It seems like curl_getinfo($ch) of type * is incompatible with the declared type array<string,*> of property $info.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
21
22
        return $e;
23
    }
24
25
    /**
26
     * Returns the curl_info array.
27
     *
28
     * @return array<string,mixed>
29
     */
30
    public function getInfo(): array
31
    {
32
        return $this->info;
33
    }
34
}
35