| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4.0119 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | 6 | public function httpClient(): PendingRequest |
|
| 34 | { |
||
| 35 | 6 | $token = $this->auth->getToken(); |
|
| 36 | 6 | if (!$token || !($token instanceof AccessToken)) { |
|
| 37 | 1 | throw new WorkcastException('Token is empty or has not valid structure'); |
|
| 38 | } |
||
| 39 | 5 | if (!$token->valid()) { |
|
| 40 | throw new WorkcastException('Token not valid ['.var_export($token->getRawData(), true).']'); |
||
| 41 | } |
||
| 42 | |||
| 43 | 5 | return Http::withToken($token->getToken()) |
|
| 44 | 5 | ->withOptions(array_merge( |
|
| 45 | 5 | config('workcast.http_reporting_config', []), |
|
| 46 | 5 | [ |
|
| 47 | 5 | 'base_uri' => config('workcast.reporting_url'), |
|
| 48 | 5 | ] |
|
| 52 |