| Conditions | 5 |
| Paths | 7 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | public function getProvider(): HubSpot |
||
| 40 | { |
||
| 41 | if ($this->provider instanceof HubSpot) { |
||
| 42 | return $this->provider; |
||
| 43 | } |
||
| 44 | |||
| 45 | // Get provider from settings |
||
| 46 | if (null !== ($provider = $this->provider ?? null)) { |
||
| 47 | $condition = [ |
||
| 48 | (is_numeric($provider) ? 'id' : 'handle') => $provider |
||
| 49 | ]; |
||
| 50 | $provider = (new ProviderQuery($condition))->one(); |
||
| 51 | } |
||
| 52 | |||
| 53 | if (!$provider instanceof HubSpot) { |
||
| 54 | $provider = new HubSpot(); |
||
| 55 | } |
||
| 56 | |||
| 57 | return $provider; |
||
| 58 | } |
||
| 59 | } |
||
| 60 |