| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2.004 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | 3 | public function getStatus($branch = 'master') |
|
| 37 | { |
||
| 38 | |||
| 39 | 3 | $sha = $this->getLatestCommitSha($branch); |
|
| 40 | |||
| 41 | 2 | $curl = new Curl(); |
|
| 42 | 2 | $curl->get($this->projectUrl . '/projects/' . $this->projectId . '/' . |
|
| 43 | 2 | 'repository/commits/' . $sha . '/statuses?private_token='. $this->privateKey); |
|
| 44 | |||
| 45 | 2 | if ($curl->error) { |
|
| 46 | throw new \Exception('Error: ' . $curl->errorCode . ': ' . $curl->errorMessage); |
||
| 47 | } |
||
| 48 | |||
| 49 | 2 | $response = $curl->response; |
|
| 50 | |||
| 51 | 2 | $this->setStatus($response); |
|
| 52 | |||
| 53 | 2 | return $this->status; |
|
| 54 | } |
||
| 55 | |||
| 92 | } |