1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
|
4
|
|
|
/**
|
5
|
|
|
* All Milo\Github exceptions at one place. Whole library does not throw anything else.
|
6
|
|
|
*
|
7
|
|
|
* @author Miloslav Hůla (https://github.com/milo)
|
8
|
|
|
*/
|
9
|
|
|
|
10
|
|
|
namespace XoopsModules\Wggithub\Github {
|
11
|
|
|
/**
|
12
|
|
|
* Marker interface.
|
13
|
|
|
*/
|
14
|
|
|
interface IException
|
15
|
|
|
{}
|
16
|
|
|
|
17
|
|
|
|
18
|
|
|
/**
|
19
|
|
|
* Wrong algorithm. API is used in wrong way. Application code should be changed.
|
20
|
|
|
*/
|
21
|
|
|
class LogicException extends \LogicException implements IException
|
22
|
|
|
{}
|
23
|
|
|
|
24
|
|
|
|
25
|
|
|
/**
|
26
|
|
|
* Substitution is used in URL path but corresponding parameter is missing.
|
27
|
|
|
*/
|
28
|
|
|
class MissingParameterException extends LogicException
|
29
|
|
|
{}
|
30
|
|
|
|
31
|
|
|
|
32
|
|
|
/**
|
33
|
|
|
* Unpredictable situation occurred.
|
34
|
|
|
*/
|
35
|
|
|
abstract class RuntimeException extends \RuntimeException implements IException
|
36
|
|
|
{}
|
37
|
|
|
|
38
|
|
|
|
39
|
|
|
/**
|
40
|
|
|
* Github API returned a non-success HTTP code or data are somehow wrong. See all following descendants.
|
41
|
|
|
*
|
42
|
|
|
* @see Api::decode()
|
43
|
|
|
* @see https://developer.github.com/v3/#client-errors
|
44
|
|
|
*/
|
45
|
|
|
abstract class ApiException extends RuntimeException
|
46
|
|
|
{
|
47
|
|
|
/** @var Http\Response|NULL */
|
48
|
|
|
private $response;
|
49
|
|
|
|
50
|
|
|
|
51
|
|
|
/**
|
52
|
|
|
* @param string
|
53
|
|
|
* @param int
|
54
|
|
|
* @param \Exception|null $previous
|
55
|
|
|
* @param Http\Response|null $response
|
56
|
|
|
*/
|
57
|
|
|
public function __construct($message = '', $code = 0, \Exception $previous = NULL, Http\Response $response = NULL)
|
58
|
|
|
{
|
59
|
|
|
parent::__construct($message, $code, $previous);
|
60
|
|
|
$this->response = clone $response;
|
61
|
|
|
}
|
62
|
|
|
|
63
|
|
|
|
64
|
|
|
/**
|
65
|
|
|
* @return Http\Response|NULL
|
66
|
|
|
*/
|
67
|
|
|
final public function getResponse()
|
68
|
|
|
{
|
69
|
|
|
return $this->response;
|
70
|
|
|
}
|
71
|
|
|
|
72
|
|
|
}
|
73
|
|
|
|
74
|
|
|
|
75
|
|
|
/**
|
76
|
|
|
* Invalid credentials (e.g. revoked token).
|
77
|
|
|
*/
|
78
|
|
|
class UnauthorizedException extends ApiException
|
79
|
|
|
{}
|
80
|
|
|
|
81
|
|
|
|
82
|
|
|
/**
|
83
|
|
|
* Invalid JSON sent to Github API.
|
84
|
|
|
*/
|
85
|
|
|
class BadRequestException extends ApiException
|
86
|
|
|
{}
|
87
|
|
|
|
88
|
|
|
|
89
|
|
|
/**
|
90
|
|
|
* Invalid structure sent to Github API (e.g. some required fields are missing).
|
91
|
|
|
*/
|
92
|
|
|
class UnprocessableEntityException extends ApiException
|
93
|
|
|
{}
|
94
|
|
|
|
95
|
|
|
|
96
|
|
|
/**
|
97
|
|
|
* Access denied.
|
98
|
|
|
* @see https://developer.github.com/v3/#authentication
|
99
|
|
|
*/
|
100
|
|
|
class ForbiddenException extends ApiException
|
101
|
|
|
{}
|
102
|
|
|
|
103
|
|
|
|
104
|
|
|
/**
|
105
|
|
|
* Rate limit exceed.
|
106
|
|
|
* @see https://developer.github.com/v3/#rate-limiting
|
107
|
|
|
*/
|
108
|
|
|
class RateLimitExceedException extends ForbiddenException
|
109
|
|
|
{}
|
110
|
|
|
|
111
|
|
|
|
112
|
|
|
/**
|
113
|
|
|
* Resource not found.
|
114
|
|
|
* @see https://developer.github.com/v3/#authentication
|
115
|
|
|
*/
|
116
|
|
|
class NotFoundException extends ApiException
|
117
|
|
|
{}
|
118
|
|
|
|
119
|
|
|
|
120
|
|
|
/**
|
121
|
|
|
* Response cannot be classified.
|
122
|
|
|
*/
|
123
|
|
|
class UnexpectedResponseException extends ApiException
|
124
|
|
|
{}
|
125
|
|
|
|
126
|
|
|
|
127
|
|
|
/**
|
128
|
|
|
* Response from Github is somehow wrong (e.g. invalid JSON decoding).
|
129
|
|
|
*/
|
130
|
|
|
class InvalidResponseException extends ApiException
|
131
|
|
|
{}
|
132
|
|
|
|
133
|
|
|
|
134
|
|
|
/**
|
135
|
|
|
* JSON cannot be decoded, or value cannot be encoded to JSON.
|
136
|
|
|
*/
|
137
|
|
|
class JsonException extends RuntimeException
|
138
|
|
|
{
|
139
|
|
|
}
|
140
|
|
|
|
141
|
|
|
}
|
142
|
|
|
|
143
|
|
|
|
144
|
|
|
namespace XoopsModules\Wggithub\Github\Http {
|
145
|
|
|
use XoopsModules\Wggithub\Github;
|
146
|
|
|
|
147
|
|
|
|
148
|
|
|
/**
|
149
|
|
|
* HTTP response is somehow wrong and cannot be processed.
|
150
|
|
|
*/
|
151
|
|
|
class BadResponseException extends Github\RuntimeException
|
152
|
|
|
{}
|
153
|
|
|
|
154
|
|
|
/**
|
155
|
|
|
* HTTP response is somehow wrong and cannot be processed.
|
156
|
|
|
*/
|
157
|
|
|
class RateLimitExceedException extends Github\RuntimeException
|
158
|
|
|
{}
|
159
|
|
|
|
160
|
|
|
}
|
161
|
|
|
|
162
|
|
|
|
163
|
|
|
namespace Milo\Github\OAuth {
|
164
|
|
|
use Milo\Github;
|
165
|
|
|
|
166
|
|
|
/**
|
167
|
|
|
* Something fails during the token obtaining.
|
168
|
|
|
*/
|
169
|
|
|
class LoginException extends Github\RuntimeException
|
|
|
|
|
170
|
|
|
{}
|
171
|
|
|
|
172
|
|
|
}
|
173
|
|
|
|
174
|
|
|
|
175
|
|
|
namespace Milo\Github\Storages {
|
176
|
|
|
use Milo\Github;
|
177
|
|
|
|
178
|
|
|
/**
|
179
|
|
|
* Directory is missing and/or cannot be created.
|
180
|
|
|
*/
|
181
|
|
|
class MissingDirectoryException extends Github\RuntimeException
|
182
|
|
|
{}
|
183
|
|
|
|
184
|
|
|
}
|
185
|
|
|
|
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