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
Pull Request — master (#71)
by
unknown
01:30
created

Settings::email_obfuscation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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