| Conditions | 4 |
| Paths | 8 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | public static function getNextWorkday() |
||
| 19 | { |
||
| 20 | $baseUrl = 'http://timor.tech/api/holiday/workday/next'; |
||
| 21 | /** @var HolidayHelper $self */ |
||
| 22 | |||
| 23 | try { |
||
| 24 | $self = \Yii::createObject(self::class); |
||
| 25 | $response = $self->sendRequest('GET', $baseUrl); |
||
| 26 | $data = json_decode($response); |
||
| 27 | if ($data->code == 0) { |
||
| 28 | return $data->workday->date; |
||
| 29 | } |
||
| 30 | } catch (GuzzleException $e) { |
||
| 31 | Log::error('holiday error', [$response ?? [], (string)$e]); |
||
| 32 | throw new ThirdPartyServiceErrorException(); |
||
| 33 | } catch (\Exception $e) { |
||
| 34 | Log::error('holiday error', [$response ?? [], (string)$e]); |
||
| 35 | throw new ThirdPartyServiceErrorException(); |
||
| 36 | } |
||
| 39 |