GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 949bbd...68fee2 )
by James
05:46 queued 04:00
created

Settings::change_automatic_https_rewrites()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
namespace Cloudflare\Zone;
4
5
use Cloudflare\Api;
6
7
/**
8
 * CloudFlare API wrapper
9
 *
10
 * Zone Settings
11
 *
12
 * @author James Bell <[email protected]>
13
 *
14
 * @version 1
15
 */
16
class Settings extends Api
17
{
18
    /**
19
     * Zone settings (permission needed: #zone_settings:read)
20
     * Available settings for your user in relation to a zone
21
     *
22
     * @param string $zone_identifier API item identifier tag
23
     */
24
    public function settings($zone_identifier)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
25
    {
26
        return $this->get('zones/'.$zone_identifier.'/settings');
27
    }
28
29
    /**
30
     * Advanced DDOS setting (permission needed: #zone_settings:read)
31
     * Advanced protection from Distributed Denial of Service (DDoS) attacks on your website.
32
     * This is an uneditable value that is 'on' in the case of Business and Enterprise zones
33
     *
34
     * @param string $zone_identifier API item identifier tag
35
     */
36
    public function advanced_ddos($zone_identifier)
37
    {
38
        return $this->get('zones/'.$zone_identifier.'/settings/advanced_ddos');
39
    }
40
41
    /**
42
     * Get Automatic HTTPS Rewrites setting (permission needed: #zone_settings:edit)
43
     * Enable the Automatic HTTPS Rewrites feature for this zone.
44
     *
45
     * @param string $zone_identifier API item identifier tag
46
     */
47
    public function automatic_https_rewrites($zone_identifier)
48
    {
49
        return $this->get('zones/'.$zone_identifier.'/settings/automatic_https_rewrites');
50
    }
51
52
    /**
53
     * Get Always Online setting (permission needed: #zone_settings:read)
54
     * When enabled, Always Online will serve pages from our cache if your server is offline
55
     * (https://support.cloudflare.com/hc/en-us/articles/200168006)
56
     *
57
     * @param string $zone_identifier API item identifier tag
58
     */
59
    public function always_online($zone_identifier)
60
    {
61
        return $this->get('zones/'.$zone_identifier.'/settings/always_online');
62
    }
63
64
    /**
65
     * Get Always Use HTTPS setting permission needed: #zone_settings:read
66
     *
67
     * Reply to all requests for URLs that use "http" with a 301 redirect to the equivalent "https" URL. If you only want to redirect for a subset of requests, consider creating an "Always use HTTPS" page rule.
68
     *
69
     * @link https://api.cloudflare.com/#zone-settings-get-always-use-https-setting
70
     *
71
     * @param string $zone_identifier API item identifier tag
72
     *
73
     * @return \stdClass | false
74
     */
75
    public function always_use_https($zone_identifier)
76
    {
77
        return $this->get('zones/' . $zone_identifier . '/settings/always_use_https');
78
    }
79
80
    /**
81
     * Get Browser Cache TTL setting (permission needed: #zone_settings:read)
82
     * Browser Cache TTL (in seconds) specifies how long CloudFlare-cached resources will remain on your visitors' computers.
83
     * CloudFlare will honor any larger times specified by your server.
84
     * (https://support.cloudflare.com/hc/en-us/articles/200168276)
85
     *
86
     * @param string $zone_identifier API item identifier tag
87
     */
88
    public function browser_cache_ttl($zone_identifier)
89
    {
90
        return $this->get('zones/'.$zone_identifier.'/settings/browser_cache_ttl');
91
    }
92
93
    /**
94
     * Get Browser Check setting (permission needed: #zone_settings:read)
95
     * Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page.
96
     * It will also challenge visitors that do not have a user agent or a non standard user agent (also commonly used by abuse bots, crawlers or visitors).
97
     * (https://support.cloudflare.com/hc/en-us/articles/200170086)
98
     *
99
     * @param string $zone_identifier API item identifier tag
100
     */
101
    public function browser_check($zone_identifier)
102
    {
103
        return $this->get('zones/'.$zone_identifier.'/settings/browser_check');
104
    }
105
106
    /**
107
     * Get Cache Level setting (permission needed: #zone_settings:read)
108
     * Cache Level functions based off the setting level. The basic setting will cache most static resources (i.e., css, images, and JavaScript).
109
     * The simplified setting will ignore the query string when delivering a cached resource. The aggressive setting will cache all static resources, including ones with a query string.
110
     * (https://support.cloudflare.com/hc/en-us/articles/200168256)
111
     *
112
     * @param string $zone_identifier API item identifier tag
113
     */
114
    public function cache_level($zone_identifier)
115
    {
116
        return $this->get('zones/'.$zone_identifier.'/settings/cache_level');
117
    }
118
119
    /**
120
     * Get Challenge TTL setting (permission needed: #zone_settings:read)
121
     * Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the TTL has expired the visitor will have to complete a new challenge.
122
     * We recommend a 15 - 45 minute setting and will attempt to honor any setting above 45 minutes.
123
     * (https://support.cloudflare.com/hc/en-us/articles/200170136)
124
     *
125
     * @param string $zone_identifier API item identifier tag
126
     */
127
    public function challenge_ttl($zone_identifier)
128
    {
129
        return $this->get('zones/'.$zone_identifier.'/settings/challenge_ttl');
130
    }
131
132
    /**
133
     * Get Development Mode setting (permission needed: #zone_settings:read)
134
     * Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site.
135
     * This will bypass CloudFlare's accelerated cache and slow down your site, but is useful if you are making changes to cacheable content (like images, css, or JavaScript) and would like to see those changes right away.
136
     * Once entered, development mode will last for 3 hours and then automatically toggle off.
137
     *
138
     * @param string $zone_identifier API item identifier tag
139
     */
140
    public function development_mode($zone_identifier)
141
    {
142
        return $this->get('zones/'.$zone_identifier.'/settings/development_mode');
143
    }
144
145
    /**
146
     * Get Email Obfuscation setting (permission needed: #zone_settings:read)
147
     * Encrypt email adresses on your web page from bots, while keeping them visible to humans.
148
     * (https://support.cloudflare.com/hc/en-us/articles/200170016)
149
     *
150
     * @param string $zone_identifier API item identifier tag
151
     */
152
    public function email_obfuscation($zone_identifier)
153
    {
154
        return $this->get('zones/'.$zone_identifier.'/settings/email_obfuscation');
155
    }
156
157
    /**
158
     * Get Hotlink Protection setting (permission needed: #zone_settings:read)
159
     * When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site.
160
     * Anytime a request for an image on your site hits CloudFlare, we check to ensure that it's not another site requesting them.
161
     * People will still be able to download and view images from your page, but other sites won't be able to steal them for use on their own pages.
162
     * (https://support.cloudflare.com/hc/en-us/articles/200170026)
163
     *
164
     * @param string $zone_identifier API item identifier tag
165
     */
166
    public function hotlink_protection($zone_identifier)
167
    {
168
        return $this->get('zones/'.$zone_identifier.'/settings/hotlink_protection');
169
    }
170
171
    /**
172
     * Get IP Geolocation setting (permission needed: #zone_settings:read)
173
     * Enable IP Geolocation to have CloudFlare geolocate visitors to your website and pass the country code to you.
174
     * (https://support.cloudflare.com/hc/en-us/articles/200168236)
175
     *
176
     * @param string $zone_identifier API item identifier tag
177
     */
178
    public function ip_geolocation($zone_identifier)
179
    {
180
        return $this->get('zones/'.$zone_identifier.'/settings/ip_geolocation');
181
    }
182
183
    /**
184
     * Get IP IPv6 setting (permission needed: #zone_settings:read)
185
     * Enable IPv6 on all subdomains that are CloudFlare enabled.
186
     * (https://support.cloudflare.com/hc/en-us/articles/200168586)
187
     *
188
     * @param string $zone_identifier API item identifier tag
189
     */
190
    public function ipv6($zone_identifier)
191
    {
192
        return $this->get('zones/'.$zone_identifier.'/settings/ipv6');
193
    }
194
195
    /**
196
     * Get IP Minify setting (permission needed: #zone_settings:read)
197
     * Automatically minify certain assets for your website (https://support.cloudflare.com/hc/en-us/articles/200168196).
198
     *
199
     * @param string $zone_identifier API item identifier tag
200
     */
201
    public function minify($zone_identifier)
202
    {
203
        return $this->get('zones/'.$zone_identifier.'/settings/minify');
204
    }
205
206
    /**
207
     * Get Mobile Redirect setting (permission needed: #zone_settings:read)
208
     * Automatically redirect visitors on mobile devices to a mobile-optimized subdomain (https://support.cloudflare.com/hc/en-us/articles/200168336).
209
     *
210
     * @param string $zone_identifier API item identifier tag
211
     */
212
    public function mobile_redirect($zone_identifier)
213
    {
214
        return $this->get('zones/'.$zone_identifier.'/settings/mobile_redirect');
215
    }
216
217
    /**
218
     * Get Mirage setting (permission needed: #zone_settings:read)
219
     * Automatically optimize image loading for website visitors on mobile devices (http://blog.cloudflare.com/mirage2-solving-mobile-speed).
220
     *
221
     * @param string $zone_identifier API item identifier tag
222
     */
223
    public function mirage($zone_identifier)
224
    {
225
        return $this->get('zones/'.$zone_identifier.'/settings/mirage');
226
    }
227
228
    /**
229
     * Get Enable Error Pages On setting (permission needed: #zone_settings:read)
230
     * CloudFlare will proxy customer error pages on any 502,504 errors on origin server instead of showing a default CloudFlare error page.
231
     * This does not apply to 522 errors and is limited to Enterprise Zones.
232
     *
233
     * @param string $zone_identifier API item identifier tag
234
     */
235
    public function origin_error_page_pass_thru($zone_identifier)
236
    {
237
        return $this->get('zones/'.$zone_identifier.'/settings/origin_error_page_pass_thru');
238
    }
239
240
    /**
241
     * Get Polish setting (permission needed: #zone_settings:read)
242
     * Strips metadata and compresses your images for faster page load times. Basic (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual quality.
243
     * Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster image loading.
244
     * Larger JPEGs are converted to progressive images, loading a lower-resolution image first and ending in a higher-resolution version. Not recommended for hi-res photography sites.
245
     *
246
     * @param string $zone_identifier API item identifier tag
247
     */
248
    public function polish($zone_identifier)
249
    {
250
        return $this->get('zones/'.$zone_identifier.'/settings/polish');
251
    }
252
253
    /**
254
     * Get Prefetch Preload setting (permission needed: #zone_settings:read)
255
     * CloudFlare will prefetch any URLs that are included in the response headers. This is limited to Enterprise Zones.
256
     *
257
     * @param string $zone_identifier API item identifier tag
258
     */
259
    public function prefetch_preload($zone_identifier)
260
    {
261
        return $this->get('zones/'.$zone_identifier.'/settings/prefetch_preload');
262
    }
263
264
    /**
265
     * Get Response Buffering setting (permission needed: #zone_settings:read)
266
     * Enables or disables buffering of responses from the proxied server. CloudFlare may buffer the whole payload to deliver it at once to the client versus allowing it to be delivered in chunks.
267
     * By default, the proxied server streams directly and is not buffered by CloudFlare. This is limited to Enterprise Zones.
268
     *
269
     * @param string $zone_identifier API item identifier tag
270
     */
271
    public function response_buffering($zone_identifier)
272
    {
273
        return $this->get('zones/'.$zone_identifier.'/settings/response_buffering');
274
    }
275
276
    /**
277
     * Get Rocket Loader setting (permission needed: #zone_settings:read)
278
     * Rocket Loader is a general-purpose asynchronous JavaScript loader coupled with a lightweight virtual browser which can safely run any JavaScript code after window.onload.
279
     * Turning on Rocket Loader will immediately improve a web page's window.onload time (assuming there is JavaScript on the page), which can have a positive impact on your Google search ranking.
280
     * Automatic Mode: Rocket Loader will automatically run on the JavaScript resources on your site, with no configuration required after turning on automatic mode. Manual Mode: In order to have Rocket Loader execute for a particular script, you must add the following attribute to the script tag: "data-cfasync='true'".
281
     * As your page passes through CloudFlare, we'll enable Rocket Loader for that particular script. All other JavaScript will continue to execute without CloudFlare touching the script. (https://support.cloudflare.com/hc/en-us/articles/200168056)
282
     *
283
     * @param string $zone_identifier API item identifier tag
284
     */
285
    public function rocket_loader($zone_identifier)
286
    {
287
        return $this->get('zones/'.$zone_identifier.'/settings/rocket_loader');
288
    }
289
290
    /**
291
     * Get Security Header (HSTS) setting (permission needed: #zone_settings:read)
292
     * CloudFlare security header for a zone.
293
     *
294
     * @param string $zone_identifier API item identifier tag
295
     */
296
    public function security_header($zone_identifier)
297
    {
298
        return $this->get('zones/'.$zone_identifier.'/settings/security_header');
299
    }
300
301
    /**
302
     * Get Security Level setting (permission needed: #zone_settings:read)
303
     * Choose the appropriate security profile for your website, which will automatically adjust each of the security settings. If you choose to customize an individual security setting, the profile will become Custom.
304
     * (https://support.cloudflare.com/hc/en-us/articles/200170056)
305
     *
306
     * @param string $zone_identifier API item identifier tag
307
     */
308
    public function security_level($zone_identifier)
309
    {
310
        return $this->get('zones/'.$zone_identifier.'/settings/security_level');
311
    }
312
313
    /**
314
     * Get Server Side Exclude setting (permission needed: #zone_settings:read)
315
     * If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do is wrap the content with CloudFlare SSE tags. Wrap any content that you want to be excluded from suspicious visitors in the following SSE tags: .
316
     * For example: Bad visitors won't see my phone number, 555-555-5555 . Note: SSE only will work with HTML. If you have HTML minification enabled, you won't see the SSE tags in your HTML source when it's served through CloudFlare.
317
     * SSE will still function in this case, as CloudFlare's HTML minification and SSE functionality occur on-the-fly as the resource moves through our network to the visitor's computer.
318
     * (https://support.cloudflare.com/hc/en-us/articles/200170036)
319
     *
320
     * @param string $zone_identifier API item identifier tag
321
     */
322
    public function server_side_exclude($zone_identifier)
323
    {
324
        return $this->get('zones/'.$zone_identifier.'/settings/server_side_exclude');
325
    }
326
327
    /**
328
     * Get Enable Query String Sort setting (permission needed: #zone_settings:read)
329
     * CloudFlare will treat files with the same query strings as the same file in cache, regardless of the order of the query strings. This is limited to Enterprise Zones.
330
     *
331
     * @param string $zone_identifier API item identifier tag
332
     */
333
    public function sort_query_string_for_cache($zone_identifier)
334
    {
335
        return $this->get('zones/'.$zone_identifier.'/settings/sort_query_string_for_cache');
336
    }
337
338
    /**
339
     * Get SSL setting (permission needed: #zone_settings:read)
340
     * SSL encrypts your visitor's connection and safeguards credit card numbers and other personal data to and from your website. SSL can take up to 5 minutes to fully activate. Requires CloudFlare active on your root domain or www domain.
341
     * Off: no SSL between the visitor and CloudFlare, and no SSL between CloudFlare and your web server (all HTTP traffic).
342
     * Flexible: SSL between the visitor and CloudFlare -- visitor sees HTTPS on your site, but no SSL between CloudFlare and your web server. You don't need to have an SSL cert on your web server, but your vistors will still see the site as being HTTPS enabled.
343
     * Full: SSL between the visitor and CloudFlare -- visitor sees HTTPS on your site, and SSL between CloudFlare and your web server. You'll need to have your own SSL cert or self-signed cert at the very least.
344
     * Full (Strict): SSL between the visitor and CloudFlare -- visitor sees HTTPS on your site, and SSL between CloudFlare and your web server. You'll need to have a valid SSL certificate installed on your web server. This certificate must be signed by a certificate authority, have an expiration date in the future, and respond for the request domain name (hostname).
345
     * (https://support.cloudflare.com/hc/en-us/articles/200170416)
346
     *
347
     * @param string $zone_identifier API item identifier tag
348
     */
349
    public function ssl($zone_identifier)
350
    {
351
        return $this->get('zones/'.$zone_identifier.'/settings/ssl');
352
    }
353
354
    /**
355
     * Get Zone Enable TLS 1.2 setting (permission needed: #zone_settings:read)
356
     * Enable Crypto TLS 1.2 feature for this zone and prevent use of previous versions. This is limited to Enterprise or Business Zones.
357
     *
358
     * @param string $zone_identifier API item identifier tag
359
     */
360
    public function tls_1_2_only($zone_identifier)
361
    {
362
        return $this->get('zones/'.$zone_identifier.'/settings/tls_1_2_only');
363
    }
364
365
    /**
366
     * Get TLS Client Auth setting (permission needed: #zone_settings:read)
367
     * TLS Client Auth requires CloudFlare to connect to your origin server using a client certificate (Enterprise Only)
368
     *
369
     * @param string $zone_identifier API item identifier tag
370
     */
371
    public function tls_client_auth($zone_identifier)
372
    {
373
        return $this->get('zones/'.$zone_identifier.'/settings/tls_client_auth');
374
    }
375
376
    /**
377
     * Get True Client IP setting (permission needed: #zone_settings:edit)
378
     * Allows customer to continue to use True Client IP (Akamai feature) in the headers we send to the origin. This is limited to Enterprise Zones.
379
     *
380
     * @param string $zone_identifier API item identifier tag
381
     */
382
    public function true_client_ip_header($zone_identifier)
383
    {
384
        return $this->get('zones/'.$zone_identifier.'/settings/true_client_ip_header');
385
    }
386
387
    /**
388
     * Get Web Application Firewall (WAF) setting (permission needed: #zone_settings:read)
389
     * The WAF examines HTTP requests to your website. It inspects both GET and POST requests and applies rules to help filter out illegitimate traffic from legitimate website visitors. The CloudFlare WAF inspects website addresses or URLs to detect anything out of the ordinary. If the CloudFlare WAF determines suspicious user behavior, then the WAF will ‘challenge’ the web visitor with a page that asks them to submit a CAPTCHA successfully to continue their action. If the challenge is failed, the action will be stopped. What this means is that CloudFlare’s WAF will block any traffic identified as illegitimate before it reaches your origin web server.
390
     * (https://support.cloudflare.com/hc/en-us/articles/200172016)
391
     *
392
     * @param string $zone_identifier API item identifier tag
393
     */
394
    public function waf($zone_identifier)
395
    {
396
        return $this->get('zones/'.$zone_identifier.'/settings/waf');
397
    }
398
399
    /**
400
     * Get Web Application Firewall (WAF) setting (permission needed: #zone_settings:edit)
401
     * Edit settings for a zone
402
     *
403
     * @param string $zone_identifier API item identifier tag
404
     * @param array  $items           One or more zone setting objects. Must contain an ID and a value.
405
     */
406
    public function edit($zone_identifier, array $items)
407
    {
408
        $data = [
409
            'items' => $items,
410
        ];
411
412
        return $this->patch('zones/'.$zone_identifier.'/settings', $data);
413
    }
414
415
    /**
416
     * Change Automatic HTTPS Rewrites setting (permission needed: #zone_settings:edit)
417
     * Enable the Automatic HTTPS Rewrites feature for this zone.
418
     *
419
     * @param string      $zone_identifier API item identifier tag
420
     * @param string|null $value           Value of the zone setting (default: off)
421
     */
422
    public function change_automatic_https_rewrites($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
423
    {
424
        $data = [
425
            'value' => $value,
426
        ];
427
428
        return $this->patch('zones/'.$zone_identifier.'/settings/automatic_https_rewrites', $data);
429
    }
430
431
    /**
432
     * Change Always Online setting (permission needed: #zone_settings:edit)
433
     * When enabled, Always Online will serve pages from our cache if your server is offline (https://support.cloudflare.com/hc/en-us/articles/200168006)
434
     *
435
     * @param string      $zone_identifier API item identifier tag
436
     * @param string|null $value           Value of the zone setting (default: on)
437
     */
438
    public function change_always_on($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
439
    {
440
        $data = [
441
            'value' => $value,
442
        ];
443
444
        return $this->patch('zones/'.$zone_identifier.'/settings/always_online', $data);
445
    }
446
447
    /**
448
     * Change Always Use HTTPS setting (permission needed: #zone_settings:edit)
449
     *
450
     * Reply to all requests for URLs that use "http" with a 301 redirect to the equivalent "https" URL. If you only want to redirect for a subset of requests, consider creating an "Always use HTTPS" page rule.
451
     *
452
     * @link https://api.cloudflare.com/#zone-settings-change-always-use-https-setting
453
     *
454
     * @param string      $zone_identifier API item identifier tag
455
     * @param string|null $value           Value of the zone setting (default: off)
456
     *
457
     * @return \stdClass | false
458
     */
459
    public function change_always_use_https($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
460
    {
461
        $data = array(
462
            'value' => $value
463
        );
464
        return $this->patch('zones/' . $zone_identifier . '/settings/always_use_https', $data);
465
    }
466
467
    /**
468
     * Change Browser Cache TTL setting (permission needed: #zone_settings:edit)
469
     * Browser Cache TTL (in seconds) specifies how long CloudFlare-cached resources will remain on your visitors' computers. CloudFlare will honor any larger times specified by your server.
470
     * (https://support.cloudflare.com/hc/en-us/articles/200168276)
471
     *
472
     * @param string   $zone_identifier API item identifier tag
473
     * @param int|null $value           Value of the zone setting (default: 14400)
474
     */
475
    public function change_browser_cache_ttl($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
476
    {
477
        $data = [
478
            'value' => $value,
479
        ];
480
481
        return $this->patch('zones/'.$zone_identifier.'/settings/browser_cache_ttl', $data);
482
    }
483
484
    /**
485
     * Change Browser Check setting (permission needed: #zone_settings:edit)
486
     * Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page.
487
     * It will also challenge visitors that do not have a user agent or a non standard user agent (also commonly used by abuse bots, crawlers or visitors).
488
     * (https://support.cloudflare.com/hc/en-us/articles/200170086)
489
     *
490
     * @param string      $zone_identifier API item identifier tag
491
     * @param string|null $value           Value of the zone setting (default: on)
492
     */
493
    public function change_browser_check($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
494
    {
495
        $data = [
496
            'value' => $value,
497
        ];
498
499
        return $this->patch('zones/'.$zone_identifier.'/settings/browser_check', $data);
500
    }
501
502
    /**
503
     * Change Cache Level setting (permission needed: #zone_settings:edit)
504
     * Cache Level functions based off the setting level. The basic setting will cache most static resources (i.e., css, images, and JavaScript).
505
     * The simplified setting will ignore the query string when delivering a cached resource. The aggressive setting will cache all static resources, including ones with a query string.
506
     * (https://support.cloudflare.com/hc/en-us/articles/200168256)
507
     *
508
     * @param string      $zone_identifier API item identifier tag
509
     * @param string|null $value           Value of the zone setting (default: on)
510
     */
511
    public function change_cache_level($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
512
    {
513
        $data = [
514
            'value' => $value,
515
        ];
516
517
        return $this->patch('zones/'.$zone_identifier.'/settings/cache_level', $data);
518
    }
519
520
    /**
521
     * Change Challenge TTL setting (permission needed: #zone_settings:edit)
522
     * Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the TTL has expired the visitor will have to complete a new challenge.
523
     * We recommend a 15 - 45 minute setting and will attempt to honor any setting above 45 minutes.
524
     * (https://support.cloudflare.com/hc/en-us/articles/200170136)
525
     *
526
     * @param string   $zone_identifier API item identifier tag
527
     * @param int|null $value           Value of the zone setting (default: on)
528
     */
529
    public function change_challenge_ttl($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
530
    {
531
        $data = [
532
            'value' => $value,
533
        ];
534
535
        return $this->patch('zones/'.$zone_identifier.'/settings/challenge_ttl', $data);
536
    }
537
538
    /**
539
     * Change Development Mode setting (permission needed: #zone_settings:edit)
540
     * Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site.
541
     * This will bypass CloudFlare's accelerated cache and slow down your site, but is useful if you are making changes to cacheable content (like images, css, or JavaScript) and would like to see those changes right away. Once entered, development mode will last for 3 hours and then automatically toggle off.
542
     *
543
     * @param string      $zone_identifier API item identifier tag
544
     * @param string|null $value           Value of the zone setting (default: on)
545
     */
546
    public function change_development_mode($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
547
    {
548
        $data = [
549
            'value' => $value,
550
        ];
551
552
        return $this->patch('zones/'.$zone_identifier.'/settings/development_mode', $data);
553
    }
554
555
    /**
556
     * Change Enable Error Pages On setting (permission needed: #zone_settings:edit)
557
     * CloudFlare will proxy customer error pages on any 502,504 errors on origin server instead of showing a default CloudFlare error page. This does not apply to 522 errors and is limited to Enterprise Zones.
558
     *
559
     * @param string      $zone_identifier API item identifier tag
560
     * @param string|null $value           Value of the zone setting (default: on)
561
     */
562
    public function change_origin_error_page_pass_thru($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
563
    {
564
        $data = [
565
            'value' => $value,
566
        ];
567
568
        return $this->patch('zones/'.$zone_identifier.'/settings/origin_error_page_pass_thru', $data);
569
    }
570
571
    /**
572
     * Change Enable Query String Sort setting (permission needed: #zone_settings:edit)
573
     * CloudFlare will treat files with the same query strings as the same file in cache, regardless of the order of the query strings. This is limited to Enterprise Zones.
574
     *
575
     * @param string      $zone_identifier API item identifier tag
576
     * @param string|null $value           Value of the zone setting (default: on)
577
     */
578
    public function change_sort_query_string_for_cache($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
579
    {
580
        $data = [
581
            'value' => $value,
582
        ];
583
584
        return $this->patch('zones/'.$zone_identifier.'/settings/sort_query_string_for_cache', $data);
585
    }
586
587
    /**
588
     * Change Hotlink Protection setting (permission needed: #zone_settings:edit)
589
     * When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site. Anytime a request for an image on your site hits CloudFlare, we check to ensure that it's not another site requesting them.
590
     * People will still be able to download and view images from your page, but other sites won't be able to steal them for use on their own pages.
591
     * (https://support.cloudflare.com/hc/en-us/articles/200170026)
592
     *
593
     * @param string      $zone_identifier API item identifier tag
594
     * @param string|null $value           Value of the zone setting (default: on)
595
     */
596
    public function change_hotlink_protection($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
597
    {
598
        $data = [
599
            'value' => $value,
600
        ];
601
602
        return $this->patch('zones/'.$zone_identifier.'/settings/hotlink_protection', $data);
603
    }
604
605
    /**
606
     * Change IP Geolocation setting (permission needed: #zone_settings:edit)
607
     * Enable IP Geolocation to have CloudFlare geolocate visitors to your website and pass the country code to you. (https://support.cloudflare.com/hc/en-us/articles/200168236)
608
     *
609
     * @param string      $zone_identifier API item identifier tag
610
     * @param string|null $value           Value of the zone setting (default: on)
611
     */
612
    public function change_ip_geolocation($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
613
    {
614
        $data = [
615
            'value' => $value,
616
        ];
617
618
        return $this->patch('zones/'.$zone_identifier.'/settings/ip_geolocation', $data);
619
    }
620
621
    /**
622
     * Change IPv6 setting (permission needed: #zone_settings:edit)
623
     * Enable IPv6 on all subdomains that are CloudFlare enabled. (https://support.cloudflare.com/hc/en-us/articles/200168586)
624
     *
625
     * @param string      $zone_identifier API item identifier tag
626
     * @param string|null $value           Value of the zone setting (default: on)
627
     */
628
    public function change_ipv6($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
629
    {
630
        $data = [
631
            'value' => $value,
632
        ];
633
634
        return $this->patch('zones/'.$zone_identifier.'/settings/ipv6', $data);
635
    }
636
637
    /**
638
     * Change Minify setting (permission needed: #zone_settings:edit)
639
     * Automatically minify certain assets for your website (https://support.cloudflare.com/hc/en-us/articles/200168196).
640
     *
641
     * @param string      $zone_identifier API item identifier tag
642
     * @param string|null $value           Value of the zone setting
643
     */
644
    public function change_minify($zone_identifier, $value)
645
    {
646
        $data = [
647
            'value' => $value,
648
        ];
649
650
        return $this->patch('zones/'.$zone_identifier.'/settings/minify', $data);
651
    }
652
653
    /**
654
     * Change Mobile Redirect setting (permission needed: #zone_settings:edit)
655
     * Automatically redirect visitors on mobile devices to a mobile-optimized subdomain (https://support.cloudflare.com/hc/en-us/articles/200168336).
656
     *
657
     * @param string      $zone_identifier API item identifier tag
658
     * @param string|null $value           Value of the zone setting (default: on)
659
     */
660
    public function change_mobile_redirect($zone_identifier, $value)
661
    {
662
        $data = [
663
            'value' => $value,
664
        ];
665
666
        return $this->patch('zones/'.$zone_identifier.'/settings/mobile_redirect', $data);
667
    }
668
669
    /**
670
     * Change Mirage setting (permission needed: #zone_settings:edit)
671
     * Automatically optimize image loading for website visitors on mobile devices (http://blog.cloudflare.com/mirage2-solving-mobile-speed).
672
     *
673
     * @param string      $zone_identifier API item identifier tag
674
     * @param string|null $value           Value of the zone setting (default: off)
675
     */
676
    public function change_mirage($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
677
    {
678
        $data = [
679
            'value' => $value,
680
        ];
681
682
        return $this->patch('zones/'.$zone_identifier.'/settings/mirage', $data);
683
    }
684
685
    /**
686
     * Change Polish setting (permission needed: #zone_settings:edit)
687
     * Strips metadata and compresses your images for faster page load times. Basic (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster image loading.
688
     * Larger JPEGs are converted to progressive images, loading a lower-resolution image first and ending in a higher-resolution version. Not recommended for hi-res photography sites.
689
     *
690
     * @param string      $zone_identifier API item identifier tag
691
     * @param string|null $value           Value of the zone setting (default: off)
692
     */
693
    public function change_polish($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
694
    {
695
        $data = [
696
            'value' => $value,
697
        ];
698
699
        return $this->patch('zones/'.$zone_identifier.'/settings/polish', $data);
700
    }
701
702
    /**
703
     * Change Prefetch Preload setting (permission needed: #zone_settings:edit)
704
     * CloudFlare will prefetch any URLs that are included in the response headers. This is limited to Enterprise Zones.
705
     *
706
     * @param string      $zone_identifier API item identifier tag
707
     * @param string|null $value           Value of the zone setting (default: off)
708
     */
709
    public function change_prefetch_preload($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
710
    {
711
        $data = [
712
            'value' => $value,
713
        ];
714
715
        return $this->patch('zones/'.$zone_identifier.'/settings/prefetch_preload', $data);
716
    }
717
718
    /**
719
     * Change Response Buffering setting (permission needed: #zone_settings:edit)
720
     * Enables or disables buffering of responses from the proxied server. CloudFlare may buffer the whole payload to deliver it at once to the client versus allowing it to be delivered in chunks.
721
     * By default, the proxied server streams directly and is not buffered by CloudFlare. This is limited to Enterprise Zones.
722
     *
723
     * @param string      $zone_identifier API item identifier tag
724
     * @param string|null $value           Value of the zone setting (default: off)
725
     */
726
    public function change_response_buffering($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
727
    {
728
        $data = [
729
            'value' => $value,
730
        ];
731
732
        return $this->patch('zones/'.$zone_identifier.'/settings/response_buffering', $data);
733
    }
734
735
    /**
736
     * Change Rocket Loader setting (permission needed: #zone_settings:edit)
737
     * Rocket Loader is a general-purpose asynchronous JavaScript loader coupled with a lightweight virtual browser which can safely run any JavaScript code after window.onload. Turning on Rocket Loader will immediately improve a web page's window.onload time (assuming there is JavaScript on the page), which can have a positive impact on your Google search ranking.
738
     * Automatic Mode: Rocket Loader will automatically run on the JavaScript resources on your site, with no configuration required after turning on automatic mode.
739
     * Manual Mode: In order to have Rocket Loader execute for a particular script, you must add the following attribute to the script tag: "data-cfasync='true'". As your page passes through CloudFlare, we'll enable Rocket Loader for that particular script.
740
     * All other JavaScript will continue to execute without CloudFlare touching the script. (https://support.cloudflare.com/hc/en-us/articles/200168056)
741
     *
742
     * @param string      $zone_identifier API item identifier tag
743
     * @param string|null $value           Value of the zone setting (default: off)
744
     */
745
    public function change_rocket_loader($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
746
    {
747
        $data = [
748
            'value' => $value,
749
        ];
750
751
        return $this->patch('zones/'.$zone_identifier.'/settings/rocket_loader', $data);
752
    }
753
754
    /**
755
     * Change Security Header (HSTS) setting (permission needed: #zone_settings:edit)
756
     * CloudFlare security header for a zone.
757
     *
758
     * @param string      $zone_identifier API item identifier tag
759
     * @param string|null $value           Value of the zone setting (default: off)
760
     */
761
    public function change_security_header($zone_identifier, $value)
762
    {
763
        $data = [
764
            'value' => $value,
765
        ];
766
767
        return $this->patch('zones/'.$zone_identifier.'/settings/security_header', $data);
768
    }
769
770
    /**
771
     * Change Security Level setting (permission needed: #zone_settings:edit)
772
     * Choose the appropriate security profile for your website, which will automatically adjust each of the security settings. If you choose to customize an individual security setting, the profile will become Custom.
773
     * (https://support.cloudflare.com/hc/en-us/articles/200170056)
774
     *
775
     * @param string      $zone_identifier API item identifier tag
776
     * @param string|null $value           Value of the zone setting (default: medium)
777
     */
778
    public function change_security_level($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
779
    {
780
        $data = [
781
            'value' => $value,
782
        ];
783
784
        return $this->patch('zones/'.$zone_identifier.'/settings/security_level', $data);
785
    }
786
787
    /**
788
     * Change Server Side Exclude setting (permission needed: #zone_settings:edit)
789
     * If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do is wrap the content with CloudFlare SSE tags.
790
     * Wrap any content that you want to be excluded from suspicious visitors in the following SSE tags: . For example: Bad visitors won't see my phone number, 555-555-5555 . Note: SSE only will work with HTML.
791
     * If you have HTML minification enabled, you won't see the SSE tags in your HTML source when it's served through CloudFlare. SSE will still function in this case, as CloudFlare's HTML minification and SSE functionality occur on-the-fly as the resource moves through our network to the visitor's computer.
792
     * (https://support.cloudflare.com/hc/en-us/articles/200170036)
793
     *
794
     * @param string      $zone_identifier API item identifier tag
795
     * @param string|null $value           Value of the zone setting (default: on)
796
     */
797
    public function change_server_side_exclude($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
798
    {
799
        $data = [
800
            'value' => $value,
801
        ];
802
803
        return $this->patch('zones/'.$zone_identifier.'/settings/server_side_exclude', $data);
804
    }
805
806
    /**
807
     * Change SSL setting (permission needed: #zone_settings:edit)
808
     * SSL encrypts your visitor's connection and safeguards credit card numbers and other personal data to and from your website. SSL can take up to 5 minutes to fully activate.
809
     * Requires CloudFlare active on your root domain or www domain.
810
     * Off: no SSL between the visitor and CloudFlare, and no SSL between CloudFlare and your web server (all HTTP traffic).
811
     * Flexible: SSL between the visitor and CloudFlare -- visitor sees HTTPS on your site, but no SSL between CloudFlare and your web server. You don't need to have an SSL cert on your web server, but your vistors will still see the site as being HTTPS enabled.
812
     * Full: SSL between the visitor and CloudFlare -- visitor sees HTTPS on your site, and SSL between CloudFlare and your web server. You'll need to have your own SSL cert or self-signed cert at the very least.
813
     * Full (Strict): SSL between the visitor and CloudFlare -- visitor sees HTTPS on your site, and SSL between CloudFlare and your web server. You'll need to have a valid SSL certificate installed on your web server. This certificate must be signed by a certificate authority, have an expiration date in the future, and respond for the request domain name (hostname).
814
     * (https://support.cloudflare.com/hc/en-us/articles/200170416)
815
     *
816
     * @param string      $zone_identifier API item identifier tag
817
     * @param string|null $value           Value of the zone setting (default: off)
818
     */
819
    public function change_ssl($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
820
    {
821
        $data = [
822
            'value' => $value,
823
        ];
824
825
        return $this->patch('zones/'.$zone_identifier.'/settings/ssl', $data);
826
    }
827
828
    /**
829
     * Change TLS Client Auth setting (permission needed: #zone_settings:edit)
830
     * TLS Client Auth requires CloudFlare to connect to your origin server using a client certificate (Enterprise Only)
831
     *
832
     * @param string      $zone_identifier API item identifier tag
833
     * @param string|null $value           Value of the zone setting (default: off)
834
     */
835
    public function change_tls_client_auth($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
836
    {
837
        $data = [
838
            'value' => $value,
839
        ];
840
841
        return $this->patch('zones/'.$zone_identifier.'/settings/tls_client_auth', $data);
842
    }
843
844
    /**
845
     * Change True Client IP setting (permission needed: #zone_settings:edit)
846
     * Allows customer to continue to use True Client IP (Akamai feature) in the headers we send to the origin. This is limited to Enterprise Zones.
847
     *
848
     * @param string      $zone_identifier API item identifier tag
849
     * @param string|null $value           Value of the zone setting (default: off)
850
     */
851
    public function change_true_client_ip_header($zone_identifier, $value = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
852
    {
853
        $data = [
854
            'value' => $value,
855
        ];
856
857
        return $this->patch('zones/'.$zone_identifier.'/settings/true_client_ip_header', $data);
858
    }
859
860
    /**
861
     * Change TLS 1.2 setting (permission needed: #zone_settings:edit)
862
     * Enable Crypto TLS 1.2 feature for this zone and prevent use of previous versions. This is limited to Enterprise or Business Zones.
863
     *
864
     * @param string      $zone_identifier API item identifier tag
865
     * @param string|null $value           Value of the zone setting (default: off)
866
     */
867
    public function change_tls_1_2_only($zone_identifier, $value = null)
868
    {
869
        $data = [
870
            'value' => $value,
871
        ];
872
873
        return $this->patch('zones/'.$zone_identifier.'/settings/true_client_ip_header', $data);
874
    }
875
876
    /**
877
     * Change Web Application Firewall (WAF) (permission needed: #zone_settings:edit)
878
     * The WAF examines HTTP requests to your website. It inspects both GET and POST requests and applies rules to help filter out illegitimate traffic from legitimate website visitors.
879
     * The CloudFlare WAF inspects website addresses or URLs to detect anything out of the ordinary. If the CloudFlare WAF determines suspicious user behavior, then the WAF will "challenge" the web visitor with a page that asks them to submit a CAPTCHA successfully to continue their action.
880
     * If the challenge is failed, the action will be stopped. What this means is that CloudFlare’s WAF will block any traffic identified as illegitimate before it reaches your origin web server.
881
     * (https://support.cloudflare.com/hc/en-us/articles/200172016)
882
     *
883
     * @param string      $zone_identifier API item identifier tag
884
     * @param string|null $value           Value of the zone setting (default: off)
885
     */
886
    public function change_waf($zone_identifier, $value = null)
887
    {
888
        $data = [
889
            'value' => $value,
890
        ];
891
892
        return $this->patch('zones/'.$zone_identifier.'/settings/waf', $data);
893
    }
894
}
895