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 ( 4eef74...99ef5b )
by James
03:46
created

Settings::change_browser_cache_ttl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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 Always Online setting (permission needed: #zone_settings:read)
43
     * When enabled, Always Online will serve pages from our cache if your server is offline
44
     * (https://support.cloudflare.com/hc/en-us/articles/200168006)
45
     *
46
     * @param string $zone_identifier API item identifier tag
47
     */
48
    public function always_online($zone_identifier)
49
    {
50
        return $this->get('zones/'.$zone_identifier.'/settings/always_online');
51
    }
52
53
    /**
54
     * Get Always Use HTTPS setting permission needed: #zone_settings:read
55
     *
56
     * 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.
57
     *
58
     * @link https://api.cloudflare.com/#zone-settings-get-always-use-https-setting
59
     *
60
     * @param string $zone_identifier API item identifier tag
61
     *
62
     * @return \stdClass | false
63
     */
64
    public function always_use_https($zone_identifier)
65
    {
66
        return $this->get('zones/' . $zone_identifier . '/settings/always_use_https');
67
    }
68
69
    /**
70
     * Get Browser Cache TTL setting (permission needed: #zone_settings:read)
71
     * Browser Cache TTL (in seconds) specifies how long CloudFlare-cached resources will remain on your visitors' computers.
72
     * CloudFlare will honor any larger times specified by your server.
73
     * (https://support.cloudflare.com/hc/en-us/articles/200168276)
74
     *
75
     * @param string $zone_identifier API item identifier tag
76
     */
77
    public function browser_cache_ttl($zone_identifier)
78
    {
79
        return $this->get('zones/'.$zone_identifier.'/settings/browser_cache_ttl');
80
    }
81
82
    /**
83
     * Get Browser Check setting (permission needed: #zone_settings:read)
84
     * 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.
85
     * 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).
86
     * (https://support.cloudflare.com/hc/en-us/articles/200170086)
87
     *
88
     * @param string $zone_identifier API item identifier tag
89
     */
90
    public function browser_check($zone_identifier)
91
    {
92
        return $this->get('zones/'.$zone_identifier.'/settings/browser_check');
93
    }
94
95
    /**
96
     * Get Cache Level setting (permission needed: #zone_settings:read)
97
     * Cache Level functions based off the setting level. The basic setting will cache most static resources (i.e., css, images, and JavaScript).
98
     * 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.
99
     * (https://support.cloudflare.com/hc/en-us/articles/200168256)
100
     *
101
     * @param string $zone_identifier API item identifier tag
102
     */
103
    public function cache_level($zone_identifier)
104
    {
105
        return $this->get('zones/'.$zone_identifier.'/settings/cache_level');
106
    }
107
108
    /**
109
     * Get Challenge TTL setting (permission needed: #zone_settings:read)
110
     * 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.
111
     * We recommend a 15 - 45 minute setting and will attempt to honor any setting above 45 minutes.
112
     * (https://support.cloudflare.com/hc/en-us/articles/200170136)
113
     *
114
     * @param string $zone_identifier API item identifier tag
115
     */
116
    public function challenge_ttl($zone_identifier)
117
    {
118
        return $this->get('zones/'.$zone_identifier.'/settings/challenge_ttl');
119
    }
120
121
    /**
122
     * Get Development Mode setting (permission needed: #zone_settings:read)
123
     * Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site.
124
     * 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.
125
     * Once entered, development mode will last for 3 hours and then automatically toggle off.
126
     *
127
     * @param string $zone_identifier API item identifier tag
128
     */
129
    public function development_mode($zone_identifier)
130
    {
131
        return $this->get('zones/'.$zone_identifier.'/settings/development_mode');
132
    }
133
134
    /**
135
     * Get Email Obfuscation setting (permission needed: #zone_settings:read)
136
     * Encrypt email adresses on your web page from bots, while keeping them visible to humans.
137
     * (https://support.cloudflare.com/hc/en-us/articles/200170016)
138
     *
139
     * @param string $zone_identifier API item identifier tag
140
     */
141
    public function email_obfuscation($zone_identifier)
142
    {
143
        return $this->get('zones/'.$zone_identifier.'/settings/email_obfuscation');
144
    }
145
146
    /**
147
     * Get Hotlink Protection setting (permission needed: #zone_settings:read)
148
     * 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.
149
     * Anytime a request for an image on your site hits CloudFlare, we check to ensure that it's not another site requesting them.
150
     * 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.
151
     * (https://support.cloudflare.com/hc/en-us/articles/200170026)
152
     *
153
     * @param string $zone_identifier API item identifier tag
154
     */
155
    public function hotlink_protection($zone_identifier)
156
    {
157
        return $this->get('zones/'.$zone_identifier.'/settings/hotlink_protection');
158
    }
159
160
    /**
161
     * Get IP Geolocation setting (permission needed: #zone_settings:read)
162
     * Enable IP Geolocation to have CloudFlare geolocate visitors to your website and pass the country code to you.
163
     * (https://support.cloudflare.com/hc/en-us/articles/200168236)
164
     *
165
     * @param string $zone_identifier API item identifier tag
166
     */
167
    public function ip_geolocation($zone_identifier)
168
    {
169
        return $this->get('zones/'.$zone_identifier.'/settings/ip_geolocation');
170
    }
171
172
    /**
173
     * Get IP IPv6 setting (permission needed: #zone_settings:read)
174
     * Enable IPv6 on all subdomains that are CloudFlare enabled.
175
     * (https://support.cloudflare.com/hc/en-us/articles/200168586)
176
     *
177
     * @param string $zone_identifier API item identifier tag
178
     */
179
    public function ipv6($zone_identifier)
180
    {
181
        return $this->get('zones/'.$zone_identifier.'/settings/ipv6');
182
    }
183
184
    /**
185
     * Get IP Minify setting (permission needed: #zone_settings:read)
186
     * Automatically minify certain assets for your website (https://support.cloudflare.com/hc/en-us/articles/200168196).
187
     *
188
     * @param string $zone_identifier API item identifier tag
189
     */
190
    public function minify($zone_identifier)
191
    {
192
        return $this->get('zones/'.$zone_identifier.'/settings/minify');
193
    }
194
195
    /**
196
     * Get Mobile Redirect setting (permission needed: #zone_settings:read)
197
     * Automatically redirect visitors on mobile devices to a mobile-optimized subdomain (https://support.cloudflare.com/hc/en-us/articles/200168336).
198
     *
199
     * @param string $zone_identifier API item identifier tag
200
     */
201
    public function mobile_redirect($zone_identifier)
202
    {
203
        return $this->get('zones/'.$zone_identifier.'/settings/mobile_redirect');
204
    }
205
206
    /**
207
     * Get Mirage setting (permission needed: #zone_settings:read)
208
     * Automatically optimize image loading for website visitors on mobile devices (http://blog.cloudflare.com/mirage2-solving-mobile-speed).
209
     *
210
     * @param string $zone_identifier API item identifier tag
211
     */
212
    public function mirage($zone_identifier)
213
    {
214
        return $this->get('zones/'.$zone_identifier.'/settings/mirage');
215
    }
216
217
    /**
218
     * Get Enable Error Pages On setting (permission needed: #zone_settings:read)
219
     * CloudFlare will proxy customer error pages on any 502,504 errors on origin server instead of showing a default CloudFlare error page.
220
     * This does not apply to 522 errors and is limited to Enterprise Zones.
221
     *
222
     * @param string $zone_identifier API item identifier tag
223
     */
224
    public function origin_error_page_pass_thru($zone_identifier)
225
    {
226
        return $this->get('zones/'.$zone_identifier.'/settings/origin_error_page_pass_thru');
227
    }
228
229
    /**
230
     * Get Polish setting (permission needed: #zone_settings:read)
231
     * 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.
232
     * Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster image loading.
233
     * 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.
234
     *
235
     * @param string $zone_identifier API item identifier tag
236
     */
237
    public function polish($zone_identifier)
238
    {
239
        return $this->get('zones/'.$zone_identifier.'/settings/polish');
240
    }
241
242
    /**
243
     * Get Prefetch Preload setting (permission needed: #zone_settings:read)
244
     * CloudFlare will prefetch any URLs that are included in the response headers. This is limited to Enterprise Zones.
245
     *
246
     * @param string $zone_identifier API item identifier tag
247
     */
248
    public function prefetch_preload($zone_identifier)
249
    {
250
        return $this->get('zones/'.$zone_identifier.'/settings/prefetch_preload');
251
    }
252
253
    /**
254
     * Get Response Buffering setting (permission needed: #zone_settings:read)
255
     * 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.
256
     * By default, the proxied server streams directly and is not buffered by CloudFlare. This is limited to Enterprise Zones.
257
     *
258
     * @param string $zone_identifier API item identifier tag
259
     */
260
    public function response_buffering($zone_identifier)
261
    {
262
        return $this->get('zones/'.$zone_identifier.'/settings/response_buffering');
263
    }
264
265
    /**
266
     * Get Rocket Loader setting (permission needed: #zone_settings:read)
267
     * 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.
268
     * 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.
269
     * 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'".
270
     * 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)
271
     *
272
     * @param string $zone_identifier API item identifier tag
273
     */
274
    public function rocket_loader($zone_identifier)
275
    {
276
        return $this->get('zones/'.$zone_identifier.'/settings/rocket_loader');
277
    }
278
279
    /**
280
     * Get Security Header (HSTS) setting (permission needed: #zone_settings:read)
281
     * CloudFlare security header for a zone.
282
     *
283
     * @param string $zone_identifier API item identifier tag
284
     */
285
    public function security_header($zone_identifier)
286
    {
287
        return $this->get('zones/'.$zone_identifier.'/settings/security_header');
288
    }
289
290
    /**
291
     * Get Security Level setting (permission needed: #zone_settings:read)
292
     * 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.
293
     * (https://support.cloudflare.com/hc/en-us/articles/200170056)
294
     *
295
     * @param string $zone_identifier API item identifier tag
296
     */
297
    public function security_level($zone_identifier)
298
    {
299
        return $this->get('zones/'.$zone_identifier.'/settings/security_level');
300
    }
301
302
    /**
303
     * Get Server Side Exclude setting (permission needed: #zone_settings:read)
304
     * 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: .
305
     * 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.
306
     * 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.
307
     * (https://support.cloudflare.com/hc/en-us/articles/200170036)
308
     *
309
     * @param string $zone_identifier API item identifier tag
310
     */
311
    public function server_side_exclude($zone_identifier)
312
    {
313
        return $this->get('zones/'.$zone_identifier.'/settings/server_side_exclude');
314
    }
315
316
    /**
317
     * Get Enable Query String Sort setting (permission needed: #zone_settings:read)
318
     * 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.
319
     *
320
     * @param string $zone_identifier API item identifier tag
321
     */
322
    public function sort_query_string_for_cache($zone_identifier)
323
    {
324
        return $this->get('zones/'.$zone_identifier.'/settings/sort_query_string_for_cache');
325
    }
326
327
    /**
328
     * Get SSL setting (permission needed: #zone_settings:read)
329
     * 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.
330
     * Off: no SSL between the visitor and CloudFlare, and no SSL between CloudFlare and your web server (all HTTP traffic).
331
     * 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.
332
     * 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.
333
     * 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).
334
     * (https://support.cloudflare.com/hc/en-us/articles/200170416)
335
     *
336
     * @param string $zone_identifier API item identifier tag
337
     */
338
    public function ssl($zone_identifier)
339
    {
340
        return $this->get('zones/'.$zone_identifier.'/settings/ssl');
341
    }
342
343
    /**
344
     * Get Zone Enable TLS 1.2 setting (permission needed: #zone_settings:read)
345
     * Enable Crypto TLS 1.2 feature for this zone and prevent use of previous versions. This is limited to Enterprise or Business Zones.
346
     *
347
     * @param string $zone_identifier API item identifier tag
348
     */
349
    public function tls_1_2_only($zone_identifier)
350
    {
351
        return $this->get('zones/'.$zone_identifier.'/settings/tls_1_2_only');
352
    }
353
354
    /**
355
     * Get TLS Client Auth setting (permission needed: #zone_settings:read)
356
     * TLS Client Auth requires CloudFlare to connect to your origin server using a client certificate (Enterprise Only)
357
     *
358
     * @param string $zone_identifier API item identifier tag
359
     */
360
    public function tls_client_auth($zone_identifier)
361
    {
362
        return $this->get('zones/'.$zone_identifier.'/settings/tls_client_auth');
363
    }
364
365
    /**
366
     * Get True Client IP setting (permission needed: #zone_settings:edit)
367
     * 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.
368
     *
369
     * @param string $zone_identifier API item identifier tag
370
     */
371
    public function true_client_ip_header($zone_identifier)
372
    {
373
        return $this->get('zones/'.$zone_identifier.'/settings/true_client_ip_header');
374
    }
375
376
    /**
377
     * Get Web Application Firewall (WAF) setting (permission needed: #zone_settings:read)
378
     * 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.
379
     * (https://support.cloudflare.com/hc/en-us/articles/200172016)
380
     *
381
     * @param string $zone_identifier API item identifier tag
382
     */
383
    public function waf($zone_identifier)
384
    {
385
        return $this->get('zones/'.$zone_identifier.'/settings/waf');
386
    }
387
388
    /**
389
     * Get Web Application Firewall (WAF) setting (permission needed: #zone_settings:edit)
390
     * Edit settings for a zone
391
     *
392
     * @param string $zone_identifier API item identifier tag
393
     * @param array  $items           One or more zone setting objects. Must contain an ID and a value.
394
     */
395
    public function edit($zone_identifier, array $items)
396
    {
397
        $data = [
398
            'items' => $items,
399
        ];
400
401
        return $this->patch('zones/'.$zone_identifier.'/settings', $data);
402
    }
403
404
    /**
405
     * Change Always Online setting (permission needed: #zone_settings:edit)
406
     * When enabled, Always Online will serve pages from our cache if your server is offline (https://support.cloudflare.com/hc/en-us/articles/200168006)
407
     *
408
     * @param string      $zone_identifier API item identifier tag
409
     * @param string|null $value           Value of the zone setting (default: on)
410
     */
411
    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...
412
    {
413
        $data = [
414
            'value' => $value,
415
        ];
416
417
        return $this->patch('zones/'.$zone_identifier.'/settings/always_online', $data);
418
    }
419
420
    /**
421
     * Change Always Use HTTPS setting (permission needed: #zone_settings:edit)
422
     *
423
     * 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.
424
     *
425
     * @link https://api.cloudflare.com/#zone-settings-change-always-use-https-setting
426
     *
427
     * @param string      $zone_identifier API item identifier tag
428
     * @param string|null $value           Value of the zone setting (default: off)
429
     *
430
     * @return \stdClass | false
431
     */
432
    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...
433
    {
434
        $data = array(
435
            'value' => $value
436
        );
437
        return $this->patch('zones/' . $zone_identifier . '/settings/always_use_https', $data);
438
    }
439
440
    /**
441
     * Change Browser Cache TTL setting (permission needed: #zone_settings:edit)
442
     * 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.
443
     * (https://support.cloudflare.com/hc/en-us/articles/200168276)
444
     *
445
     * @param string   $zone_identifier API item identifier tag
446
     * @param int|null $value           Value of the zone setting (default: 14400)
447
     */
448
    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...
449
    {
450
        $data = [
451
            'value' => $value,
452
        ];
453
454
        return $this->patch('zones/'.$zone_identifier.'/settings/browser_cache_ttl', $data);
455
    }
456
457
    /**
458
     * Change Browser Check setting (permission needed: #zone_settings:edit)
459
     * 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.
460
     * 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).
461
     * (https://support.cloudflare.com/hc/en-us/articles/200170086)
462
     *
463
     * @param string      $zone_identifier API item identifier tag
464
     * @param string|null $value           Value of the zone setting (default: on)
465
     */
466
    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...
467
    {
468
        $data = [
469
            'value' => $value,
470
        ];
471
472
        return $this->patch('zones/'.$zone_identifier.'/settings/browser_check', $data);
473
    }
474
475
    /**
476
     * Change Cache Level setting (permission needed: #zone_settings:edit)
477
     * Cache Level functions based off the setting level. The basic setting will cache most static resources (i.e., css, images, and JavaScript).
478
     * 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.
479
     * (https://support.cloudflare.com/hc/en-us/articles/200168256)
480
     *
481
     * @param string      $zone_identifier API item identifier tag
482
     * @param string|null $value           Value of the zone setting (default: on)
483
     */
484
    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...
485
    {
486
        $data = [
487
            'value' => $value,
488
        ];
489
490
        return $this->patch('zones/'.$zone_identifier.'/settings/cache_level', $data);
491
    }
492
493
    /**
494
     * Change Challenge TTL setting (permission needed: #zone_settings:edit)
495
     * 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.
496
     * We recommend a 15 - 45 minute setting and will attempt to honor any setting above 45 minutes.
497
     * (https://support.cloudflare.com/hc/en-us/articles/200170136)
498
     *
499
     * @param string   $zone_identifier API item identifier tag
500
     * @param int|null $value           Value of the zone setting (default: on)
501
     */
502
    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...
503
    {
504
        $data = [
505
            'value' => $value,
506
        ];
507
508
        return $this->patch('zones/'.$zone_identifier.'/settings/challenge_ttl', $data);
509
    }
510
511
    /**
512
     * Change Development Mode setting (permission needed: #zone_settings:edit)
513
     * Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site.
514
     * 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.
515
     *
516
     * @param string      $zone_identifier API item identifier tag
517
     * @param string|null $value           Value of the zone setting (default: on)
518
     */
519
    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...
520
    {
521
        $data = [
522
            'value' => $value,
523
        ];
524
525
        return $this->patch('zones/'.$zone_identifier.'/settings/development_mode', $data);
526
    }
527
528
    /**
529
     * Change Enable Error Pages On setting (permission needed: #zone_settings:edit)
530
     * 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.
531
     *
532
     * @param string      $zone_identifier API item identifier tag
533
     * @param string|null $value           Value of the zone setting (default: on)
534
     */
535
    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...
536
    {
537
        $data = [
538
            'value' => $value,
539
        ];
540
541
        return $this->patch('zones/'.$zone_identifier.'/settings/origin_error_page_pass_thru', $data);
542
    }
543
544
    /**
545
     * Change Enable Query String Sort setting (permission needed: #zone_settings:edit)
546
     * 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.
547
     *
548
     * @param string      $zone_identifier API item identifier tag
549
     * @param string|null $value           Value of the zone setting (default: on)
550
     */
551
    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...
552
    {
553
        $data = [
554
            'value' => $value,
555
        ];
556
557
        return $this->patch('zones/'.$zone_identifier.'/settings/sort_query_string_for_cache', $data);
558
    }
559
560
    /**
561
     * Change Hotlink Protection setting (permission needed: #zone_settings:edit)
562
     * 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.
563
     * 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.
564
     * (https://support.cloudflare.com/hc/en-us/articles/200170026)
565
     *
566
     * @param string      $zone_identifier API item identifier tag
567
     * @param string|null $value           Value of the zone setting (default: on)
568
     */
569
    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...
570
    {
571
        $data = [
572
            'value' => $value,
573
        ];
574
575
        return $this->patch('zones/'.$zone_identifier.'/settings/hotlink_protection', $data);
576
    }
577
578
    /**
579
     * Change IP Geolocation setting (permission needed: #zone_settings:edit)
580
     * 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)
581
     *
582
     * @param string      $zone_identifier API item identifier tag
583
     * @param string|null $value           Value of the zone setting (default: on)
584
     */
585
    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...
586
    {
587
        $data = [
588
            'value' => $value,
589
        ];
590
591
        return $this->patch('zones/'.$zone_identifier.'/settings/ip_geolocation', $data);
592
    }
593
594
    /**
595
     * Change IPv6 setting (permission needed: #zone_settings:edit)
596
     * Enable IPv6 on all subdomains that are CloudFlare enabled. (https://support.cloudflare.com/hc/en-us/articles/200168586)
597
     *
598
     * @param string      $zone_identifier API item identifier tag
599
     * @param string|null $value           Value of the zone setting (default: on)
600
     */
601
    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...
602
    {
603
        $data = [
604
            'value' => $value,
605
        ];
606
607
        return $this->patch('zones/'.$zone_identifier.'/settings/ipv6', $data);
608
    }
609
610
    /**
611
     * Change Minify setting (permission needed: #zone_settings:edit)
612
     * Automatically minify certain assets for your website (https://support.cloudflare.com/hc/en-us/articles/200168196).
613
     *
614
     * @param string      $zone_identifier API item identifier tag
615
     * @param string|null $value           Value of the zone setting
616
     */
617
    public function change_minify($zone_identifier, $value)
618
    {
619
        $data = [
620
            'value' => $value,
621
        ];
622
623
        return $this->patch('zones/'.$zone_identifier.'/settings/minify', $data);
624
    }
625
626
    /**
627
     * Change Mobile Redirect setting (permission needed: #zone_settings:edit)
628
     * Automatically redirect visitors on mobile devices to a mobile-optimized subdomain (https://support.cloudflare.com/hc/en-us/articles/200168336).
629
     *
630
     * @param string      $zone_identifier API item identifier tag
631
     * @param string|null $value           Value of the zone setting (default: on)
632
     */
633
    public function change_mobile_redirect($zone_identifier, $value)
634
    {
635
        $data = [
636
            'value' => $value,
637
        ];
638
639
        return $this->patch('zones/'.$zone_identifier.'/settings/mobile_redirect', $data);
640
    }
641
642
    /**
643
     * Change Mirage setting (permission needed: #zone_settings:edit)
644
     * Automatically optimize image loading for website visitors on mobile devices (http://blog.cloudflare.com/mirage2-solving-mobile-speed).
645
     *
646
     * @param string      $zone_identifier API item identifier tag
647
     * @param string|null $value           Value of the zone setting (default: off)
648
     */
649
    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...
650
    {
651
        $data = [
652
            'value' => $value,
653
        ];
654
655
        return $this->patch('zones/'.$zone_identifier.'/settings/mirage', $data);
656
    }
657
658
    /**
659
     * Change Polish setting (permission needed: #zone_settings:edit)
660
     * 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.
661
     * 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.
662
     *
663
     * @param string      $zone_identifier API item identifier tag
664
     * @param string|null $value           Value of the zone setting (default: off)
665
     */
666
    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...
667
    {
668
        $data = [
669
            'value' => $value,
670
        ];
671
672
        return $this->patch('zones/'.$zone_identifier.'/settings/polish', $data);
673
    }
674
675
    /**
676
     * Change Prefetch Preload setting (permission needed: #zone_settings:edit)
677
     * CloudFlare will prefetch any URLs that are included in the response headers. This is limited to Enterprise Zones.
678
     *
679
     * @param string      $zone_identifier API item identifier tag
680
     * @param string|null $value           Value of the zone setting (default: off)
681
     */
682
    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...
683
    {
684
        $data = [
685
            'value' => $value,
686
        ];
687
688
        return $this->patch('zones/'.$zone_identifier.'/settings/prefetch_preload', $data);
689
    }
690
691
    /**
692
     * Change Response Buffering setting (permission needed: #zone_settings:edit)
693
     * 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.
694
     * By default, the proxied server streams directly and is not buffered by CloudFlare. This is limited to Enterprise Zones.
695
     *
696
     * @param string      $zone_identifier API item identifier tag
697
     * @param string|null $value           Value of the zone setting (default: off)
698
     */
699
    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...
700
    {
701
        $data = [
702
            'value' => $value,
703
        ];
704
705
        return $this->patch('zones/'.$zone_identifier.'/settings/response_buffering', $data);
706
    }
707
708
    /**
709
     * Change Rocket Loader setting (permission needed: #zone_settings:edit)
710
     * 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.
711
     * Automatic Mode: Rocket Loader will automatically run on the JavaScript resources on your site, with no configuration required after turning on automatic mode.
712
     * 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.
713
     * All other JavaScript will continue to execute without CloudFlare touching the script. (https://support.cloudflare.com/hc/en-us/articles/200168056)
714
     *
715
     * @param string      $zone_identifier API item identifier tag
716
     * @param string|null $value           Value of the zone setting (default: off)
717
     */
718
    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...
719
    {
720
        $data = [
721
            'value' => $value,
722
        ];
723
724
        return $this->patch('zones/'.$zone_identifier.'/settings/rocket_loader', $data);
725
    }
726
727
    /**
728
     * Change Security Header (HSTS) setting (permission needed: #zone_settings:edit)
729
     * CloudFlare security header for a zone.
730
     *
731
     * @param string      $zone_identifier API item identifier tag
732
     * @param string|null $value           Value of the zone setting (default: off)
733
     */
734
    public function change_security_header($zone_identifier, $value)
735
    {
736
        $data = [
737
            'value' => $value,
738
        ];
739
740
        return $this->patch('zones/'.$zone_identifier.'/settings/security_header', $data);
741
    }
742
743
    /**
744
     * Change Security Level setting (permission needed: #zone_settings:edit)
745
     * 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.
746
     * (https://support.cloudflare.com/hc/en-us/articles/200170056)
747
     *
748
     * @param string      $zone_identifier API item identifier tag
749
     * @param string|null $value           Value of the zone setting (default: medium)
750
     */
751
    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...
752
    {
753
        $data = [
754
            'value' => $value,
755
        ];
756
757
        return $this->patch('zones/'.$zone_identifier.'/settings/security_level', $data);
758
    }
759
760
    /**
761
     * Change Server Side Exclude setting (permission needed: #zone_settings:edit)
762
     * 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.
763
     * 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.
764
     * 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.
765
     * (https://support.cloudflare.com/hc/en-us/articles/200170036)
766
     *
767
     * @param string      $zone_identifier API item identifier tag
768
     * @param string|null $value           Value of the zone setting (default: on)
769
     */
770
    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...
771
    {
772
        $data = [
773
            'value' => $value,
774
        ];
775
776
        return $this->patch('zones/'.$zone_identifier.'/settings/server_side_exclude', $data);
777
    }
778
779
    /**
780
     * Change SSL setting (permission needed: #zone_settings:edit)
781
     * 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.
782
     * Requires CloudFlare active on your root domain or www domain.
783
     * Off: no SSL between the visitor and CloudFlare, and no SSL between CloudFlare and your web server (all HTTP traffic).
784
     * 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.
785
     * 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.
786
     * 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).
787
     * (https://support.cloudflare.com/hc/en-us/articles/200170416)
788
     *
789
     * @param string      $zone_identifier API item identifier tag
790
     * @param string|null $value           Value of the zone setting (default: off)
791
     */
792
    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...
793
    {
794
        $data = [
795
            'value' => $value,
796
        ];
797
798
        return $this->patch('zones/'.$zone_identifier.'/settings/ssl', $data);
799
    }
800
801
    /**
802
     * Change TLS Client Auth setting (permission needed: #zone_settings:edit)
803
     * TLS Client Auth requires CloudFlare to connect to your origin server using a client certificate (Enterprise Only)
804
     *
805
     * @param string      $zone_identifier API item identifier tag
806
     * @param string|null $value           Value of the zone setting (default: off)
807
     */
808
    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...
809
    {
810
        $data = [
811
            'value' => $value,
812
        ];
813
814
        return $this->patch('zones/'.$zone_identifier.'/settings/tls_client_auth', $data);
815
    }
816
817
    /**
818
     * Change True Client IP setting (permission needed: #zone_settings:edit)
819
     * 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.
820
     *
821
     * @param string      $zone_identifier API item identifier tag
822
     * @param string|null $value           Value of the zone setting (default: off)
823
     */
824
    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...
825
    {
826
        $data = [
827
            'value' => $value,
828
        ];
829
830
        return $this->patch('zones/'.$zone_identifier.'/settings/true_client_ip_header', $data);
831
    }
832
833
    /**
834
     * Change TLS 1.2 setting (permission needed: #zone_settings:edit)
835
     * Enable Crypto TLS 1.2 feature for this zone and prevent use of previous versions. This is limited to Enterprise or Business Zones.
836
     *
837
     * @param string      $zone_identifier API item identifier tag
838
     * @param string|null $value           Value of the zone setting (default: off)
839
     */
840
    public function change_tls_1_2_only($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...
841
    {
842
        $data = [
843
            'value' => $value,
844
        ];
845
846
        return $this->patch('zones/'.$zone_identifier.'/settings/true_client_ip_header', $data);
847
    }
848
849
    /**
850
     * Change Web Application Firewall (WAF) (permission needed: #zone_settings:edit)
851
     * 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.
852
     * 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.
853
     * 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.
854
     * (https://support.cloudflare.com/hc/en-us/articles/200172016)
855
     *
856
     * @param string      $zone_identifier API item identifier tag
857
     * @param string|null $value           Value of the zone setting (default: off)
858
     */
859
    public function change_waf($zone_identifier, $value = null)
860
    {
861
        $data = [
862
            'value' => $value,
863
        ];
864
865
        return $this->patch('zones/'.$zone_identifier.'/settings/waf', $data);
866
    }
867
}
868