AdditionalDomains.php
1 year ago
Base.php
8 months ago
Cache.php
1 year ago
ExcludedUrls.php
1 year ago
Excludes.php
1 year ago
Integration.php
1 year ago
RemoteConfigFetcher.php
1 year ago
RequestMaker.php
1 year ago
Response.php
1 year ago
ResponseStatus.php
1 year ago
SafeMode.php
1 year ago
SecureRequestMaker.php
1 year ago
SignedBase.php
1 year ago
Stats.php
1 year ago
Tagger.php
1 year ago
Url.php
1 year ago
VariationCookie.php
1 year ago
Varnish.php
1 year ago
Warmup.php
1 year ago
Webhook.php
1 year ago
SafeMode.php
47 lines
| 1 | <?php |
| 2 | namespace NitroPack\SDK\Api; |
| 3 | |
| 4 | class SafeMode extends SignedBase { |
| 5 | public function status() { |
| 6 | $path = 'safemode/status/' . $this->siteId; |
| 7 | |
| 8 | $httpResponse = $this->makeRequest($path); |
| 9 | |
| 10 | $status = ResponseStatus::getStatus($httpResponse->getStatusCode()); |
| 11 | switch ($status) { |
| 12 | case ResponseStatus::OK: |
| 13 | return json_decode($httpResponse->getBody()); |
| 14 | default: |
| 15 | $this->throwException($httpResponse, 'Error while enabling safe mode: %s'); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | public function enable() { |
| 20 | $path = 'safemode/enable/' . $this->siteId; |
| 21 | |
| 22 | $httpResponse = $this->makeRequest($path, array(), array(), 'POST'); |
| 23 | |
| 24 | $status = ResponseStatus::getStatus($httpResponse->getStatusCode()); |
| 25 | switch ($status) { |
| 26 | case ResponseStatus::OK: |
| 27 | return true; |
| 28 | default: |
| 29 | $this->throwException($httpResponse, 'Error while enabling safe mode: %s'); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | public function disable() { |
| 34 | $path = 'safemode/disable/' . $this->siteId; |
| 35 | |
| 36 | $httpResponse = $this->makeRequest($path, array(), array(), 'POST'); |
| 37 | |
| 38 | $status = ResponseStatus::getStatus($httpResponse->getStatusCode()); |
| 39 | switch ($status) { |
| 40 | case ResponseStatus::OK: |
| 41 | return true; |
| 42 | default: |
| 43 | $this->throwException($httpResponse, 'Error while disabling safe mode: %s'); |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 |