|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* ActiveRecord for API |
|
4
|
|
|
* |
|
5
|
|
|
* @link https://github.com/hiqdev/yii2-hiart |
|
6
|
|
|
* @package yii2-hiart |
|
7
|
|
|
* @license BSD-3-Clause |
|
8
|
|
|
* @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace hiqdev\hiart\curl; |
|
12
|
|
|
|
|
13
|
|
|
use hiqdev\hiart\AbstractRequest; |
|
14
|
|
|
use hiqdev\hiart\AbstractResponse; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* For creating response manually. |
|
18
|
|
|
*/ |
|
19
|
|
|
class ManualResponse extends AbstractResponse |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var mixed |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $data; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var array[] |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $headers = []; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $statusCode; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
*/ |
|
39
|
|
|
protected $reasonPhrase; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @param AbstractRequest $request |
|
43
|
|
|
* @param mixed $data |
|
44
|
|
|
* @param array $headers |
|
45
|
|
|
* @param string $statusCode |
|
46
|
|
|
* @param string $reasonPhrase |
|
47
|
|
|
*/ |
|
48
|
|
|
public function __construct(RequestInterface $request, $data, array $headers = [], $statusCode = null, $reasonPhrase = null) |
|
|
|
|
|
|
49
|
|
|
{ |
|
50
|
|
|
$this->request = $request; |
|
51
|
|
|
$this->data = $data; |
|
52
|
|
|
$this->headers = $headers; |
|
53
|
|
|
$this->statusCode = $statusCode; |
|
54
|
|
|
$this->reasonPhrase = $reasonPhrase; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return mixed |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getData() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->data; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return mixed |
|
67
|
|
|
*/ |
|
68
|
|
|
public function getRawData() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->data; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @param string $name the header name |
|
75
|
|
|
* @return array|null |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getHeader($name) |
|
78
|
|
|
{ |
|
79
|
|
|
return isset($this->headers[strtolower($name)]) ? $this->headers[strtolower($name)] : null; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* {@inheritdoc} |
|
84
|
|
|
*/ |
|
85
|
|
|
public function getStatusCode() |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->statusCode; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* {@inheritdoc} |
|
92
|
|
|
*/ |
|
93
|
|
|
public function getReasonPhrase() |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->reasonPhrase; |
|
|
|
|
|
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Returns array of all headers. |
|
100
|
|
|
* Key - Header name |
|
101
|
|
|
* Value - array of header values. For example:. |
|
102
|
|
|
* |
|
103
|
|
|
* ```php |
|
104
|
|
|
* ['Location' => ['http://example.com'], 'Expires' => ['Thu, 01 Jan 1970 00:00:00 GMT']] |
|
105
|
|
|
* @return array |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getHeaders() |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->headers; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths