| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 7 | ||
| Bugs | 7 | Features | 1 |
| 1 | <?php |
||
| 43 | 2 | public function getRepos() |
|
| 44 | { |
||
| 45 | 2 | $url = "https://api.github.com/users/{$this->username}/repos"; |
|
| 46 | 2 | $client = new Client(); |
|
| 47 | //will return http response with the body in json format |
||
| 48 | 2 | $res = $client->request('GET', $url, ['exceptions' => false]); |
|
| 49 | 2 | if ($res->getStatusCode() == 404) { |
|
| 50 | 1 | throw new EvangelizeException("The username you passed is not a valid Github username", 1); |
|
| 51 | } |
||
| 52 | 1 | $decoded = json_decode($res->getBody(), true); |
|
| 53 | 1 | $number = count($decoded); |
|
| 54 | 1 | return $number; |
|
| 55 | } |
||
| 56 | |||
| 57 | } |