1 | <?php |
||
9 | class GithubClientProvider extends Application |
||
10 | { |
||
11 | |||
12 | |||
13 | protected $github_token = ""; |
||
14 | |||
15 | protected $client; |
||
16 | |||
17 | protected $base_url = "https://api.github.com/search/commits"; |
||
18 | |||
19 | protected $query_string = ""; |
||
20 | |||
21 | |||
22 | /** |
||
23 | * GithubClientProvider constructor. |
||
24 | * @param null|\Silly\Edition\Pimple\Application $app |
||
25 | * @param Client $client |
||
26 | * @codeCoverageIgnore |
||
27 | */ |
||
28 | public function __construct($app, Client $client) |
||
34 | |||
35 | |||
36 | public function getLatestCommits($query = []) |
||
51 | |||
52 | /** |
||
53 | * @return string |
||
54 | * @codeCoverageIgnore |
||
55 | */ |
||
56 | public function getGithubToken() |
||
63 | |||
64 | /** |
||
65 | * @param string $github_token |
||
66 | */ |
||
67 | public function setGithubToken($github_token = null) |
||
74 | |||
75 | /** |
||
76 | * @return Client |
||
77 | * @codeCoverageIgnore |
||
78 | */ |
||
79 | public function getClient() |
||
83 | |||
84 | /** |
||
85 | * @param Client $client |
||
86 | * @codeCoverageIgnore |
||
87 | */ |
||
88 | public function setClient($client) |
||
92 | |||
93 | /** |
||
94 | * @param $results |
||
95 | * @return array|mixed |
||
96 | * @codeCoverageIgnore |
||
97 | */ |
||
98 | private function returnResults($results) |
||
108 | |||
109 | public function getQueryString() |
||
113 | |||
114 | |||
115 | |||
116 | /** |
||
117 | * @param string $query_string |
||
118 | */ |
||
119 | public function setQueryString($query = []) |
||
137 | |||
138 | private function transformResults($results = []) |
||
147 | |||
148 | /** |
||
149 | * @param $value |
||
150 | * @return array |
||
151 | * @codeCoverageIgnore |
||
152 | */ |
||
153 | private function getResult($value) |
||
161 | |||
162 | /** |
||
163 | * @param $results |
||
164 | * @return bool |
||
165 | * @codeCoverageIgnore |
||
166 | */ |
||
167 | private function isGuzzleResponse($results) |
||
171 | |||
172 | /** |
||
173 | * @param $value |
||
174 | * @return string |
||
175 | * @codeCoverageIgnore |
||
176 | */ |
||
177 | private function getDate($value) |
||
181 | } |
||
182 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: