| Conditions | 6 |
| Paths | 8 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 58 | protected function url($endpoint): string |
||
| 59 | { |
||
| 60 | $baseUrl = rtrim($this->baseUrl, '/'); |
||
| 61 | |||
| 62 | // Mandatory to make sure we have the last version modified by the scripts |
||
| 63 | $this->config['use_preview'] = config('contentful.use_preview'); |
||
| 64 | |||
| 65 | if ((isset($this->config['use_preview']) && $this->config['use_preview'] == true) && ! empty($this->previewBaseUrl)) { |
||
| 66 | $baseUrl = rtrim($this->previewBaseUrl, '/'); |
||
| 67 | } |
||
| 68 | |||
| 69 | $environment = (isset($this->config['use_environment']) && $this->config['use_environment'] == true) ? '/environments/' . $this->config['environment'] . '/' : '/'; |
||
| 70 | |||
| 71 | return $baseUrl . '/spaces/' . $this->config['space_id'] . $environment . trim($endpoint, '/'); |
||
| 72 | } |
||
| 85 |