Completed
Pull Request — master (#34)
by Adam
02:12
created

Environment::deployCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 15
rs 9.9666
c 1
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace AcquiaCloudApi\Endpoints;
4
5
use AcquiaCloudApi\Connector\ClientInterface;
6
use AcquiaCloudApi\Response\EnvironmentResponse;
7
use AcquiaCloudApi\Response\EnvironmentsResponse;
8
use AcquiaCloudApi\Response\DatabasesResponse;
9
use AcquiaCloudApi\Response\CronsResponse;
10
use AcquiaCloudApi\Response\CronResponse;
11
use AcquiaCloudApi\Response\BackupsResponse;
12
use AcquiaCloudApi\Response\BackupResponse;
13
use AcquiaCloudApi\Response\DomainsResponse;
14
use AcquiaCloudApi\Response\DomainResponse;
15
use AcquiaCloudApi\Response\InsightsResponse;
16
use AcquiaCloudApi\Response\ServersResponse;
17
use AcquiaCloudApi\Response\OperationResponse;
18
19
/**
20
 * Class Client
21
 * @package AcquiaCloudApi\CloudApi
22
 */
23
class Environment implements CloudApi
24
{
25
26
    /** @var ClientInterface The API client. */
27
    protected $client;
28
29
    /**
30
     * Client constructor.
31
     *
32
     * @param ClientInterface $client
33
     */
34
    public function __construct(ClientInterface $client)
35
    {
36
        $this->client = $client;
37
    }
38
39
    /**
40
     * Shows all databases in an environment.
41
     *
42
     * @param string $environmentUuid
43
     * @return DatabasesResponse
44
     */
45
    public function getDatabases($environmentUuid)
46
    {
47
        return new DatabasesResponse(
48
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...nmentUuid.'/databases') can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $databases of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

48
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
49
                'get',
50
                "/environments/${environmentUuid}/databases"
51
            )
52
        );
53
    }
54
55
    /**
56
     * Copies a database from an environment to an environment.
57
     *
58
     * @param string $environmentFromUuid
59
     * @param string $dbName
60
     * @param string $environmentToUuid
61
     * @return OperationResponse
62
     */
63
    public function databaseCopy($environmentFromUuid, $dbName, $environmentToUuid)
64
    {
65
        $options = [
66
            'form_params' => [
67
                'name' => $dbName,
68
                'source' => $environmentFromUuid,
69
            ],
70
        ];
71
72
        return new OperationResponse(
73
            $this->client->request('post', "/environments/${environmentToUuid}/databases", $options)
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...'/databases', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

73
            /** @scrutinizer ignore-type */ $this->client->request('post', "/environments/${environmentToUuid}/databases", $options)
Loading history...
74
        );
75
    }
76
77
    /**
78
     * Backup a database.
79
     *
80
     * @param string $environmentUuid
81
     * @param string $dbName
82
     * @return OperationResponse
83
     */
84
    public function createDatabaseBackup($environmentUuid, $dbName)
85
    {
86
        return new OperationResponse(
87
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...s/'.$dbName.'/backups') can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

87
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
88
                'post',
89
                "/environments/${environmentUuid}/databases/${dbName}/backups"
90
            )
91
        );
92
    }
93
94
    /**
95
     * Shows all database backups in an environment.
96
     *
97
     * @param string $environmentUuid
98
     * @param string $dbName
99
     * @return BackupsResponse
100
     */
101
    public function getDatabaseBackups($environmentUuid, $dbName)
102
    {
103
        return new BackupsResponse(
104
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...s/'.$dbName.'/backups') can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $backups of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

104
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
105
                'get',
106
                "/environments/${environmentUuid}/databases/${dbName}/backups"
107
            )
108
        );
109
    }
110
111
    /**
112
     * Gets information about a database backup.
113
     *
114
     * @param string $environmentUuid
115
     * @param string $dbName
116
     * @param int    $backupId
117
     * @return BackupResponse
118
     */
119
    public function getDatabaseBackup($environmentUuid, $dbName, $backupId)
120
    {
121
        return new BackupResponse(
122
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('....'/backups/'.$backupId) can also be of type array; however, parameter $backup of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

122
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
123
                'get',
124
                "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}"
125
            )
126
        );
127
    }
128
129
    /**
130
     * Restores a database backup to a database in an environment.
131
     *
132
     * @param string $environmentUuid
133
     * @param string $dbName
134
     * @param int    $backupId
135
     * @return OperationResponse
136
     */
137
    public function restoreDatabaseBackup($environmentUuid, $dbName, $backupId)
138
    {
139
        return new OperationResponse(
140
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...pId.'/actions/restore') can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

140
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
141
                'post',
142
                "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}/actions/restore"
143
            )
144
        );
145
    }
146
147
    /**
148
     * Copies files from an environment to another environment.
149
     *
150
     * @param string $environmentUuidFrom
151
     * @param string $environmentUuidTo
152
     * @return OperationResponse
153
     */
154
    public function copyFiles($environmentUuidFrom, $environmentUuidTo)
155
    {
156
        $options = [
157
            'form_params' => [
158
                'source' => $environmentUuidFrom,
159
            ],
160
        ];
161
162
        return new OperationResponse(
163
            $this->client->request('post', "/environments/${environmentUuidTo}/files", $options)
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...dTo.'/files', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

163
            /** @scrutinizer ignore-type */ $this->client->request('post', "/environments/${environmentUuidTo}/files", $options)
Loading history...
164
        );
165
    }
166
167
    /**
168
     * Deploys a code branch/tag to an environment.
169
     *
170
     * @param string $environmentUuid
171
     * @param string $branch
172
     * @return OperationResponse
173
     */
174
    public function switchCode($environmentUuid, $branch)
175
    {
176
177
        $options = [
178
            'form_params' => [
179
                'branch' => $branch,
180
            ],
181
        ];
182
183
        return new OperationResponse(
184
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...ions/switch', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

184
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
185
                'post',
186
                "/environments/${environmentUuid}/code/actions/switch",
187
                $options
188
            )
189
        );
190
    }
191
192
    /**
193
     * Deploys code from one environment to another environment.
194
     *
195
     * @param string $environmentFromUuid
196
     * @param string $environmentToUuid
197
     * @param string $commitMessage
198
     */
199
    public function deployCode($environmentFromUuid, $environmentToUuid, $commitMessage = null)
200
    {
201
202
        $options = [
203
            'form_params' => [
204
                'source' => $environmentFromUuid,
205
                'message' => $commitMessage,
206
            ],
207
        ];
208
209
        return new OperationResponse(
210
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...Uuid.'/code', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

210
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
211
                'post',
212
                "/environments/${environmentToUuid}/code",
213
                $options
214
            )
215
        );
216
    }
217
218
    /**
219
     * Shows all domains on an environment.
220
     *
221
     * @param string $environmentUuid
222
     * @return DomainsResponse
223
     */
224
    public function getDomains($environmentUuid)
225
    {
226
        return new DomainsResponse(
227
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...ronmentUuid.'/domains') can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $domains of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

227
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
228
                'get',
229
                "/environments/${environmentUuid}/domains"
230
            )
231
        );
232
    }
233
234
    /**
235
     * Return details about a domain.
236
     *
237
     * @param string $environmentUuid
238
     * @param string $domain
239
     * @return DomainResponse
240
     */
241
    public function getDomain($environmentUuid, $domain)
242
    {
243
        return new DomainResponse(
244
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...id.'/domains/'.$domain) can also be of type array; however, parameter $domain of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

244
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
245
                'get',
246
                "/environments/${environmentUuid}/domains/${domain}"
247
            )
248
        );
249
    }
250
251
    /**
252
     * Adds a domain to an environment.
253
     *
254
     * @param string $environmentUuid
255
     * @param string $hostname
256
     * @return OperationResponse
257
     */
258
    public function createDomain($environmentUuid, $hostname)
259
    {
260
261
        $options = [
262
            'form_params' => [
263
                'hostname' => $hostname,
264
            ],
265
        ];
266
267
        return new OperationResponse(
268
            $this->client->request('post', "/environments/${environmentUuid}/domains", $options)
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...d.'/domains', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

268
            /** @scrutinizer ignore-type */ $this->client->request('post', "/environments/${environmentUuid}/domains", $options)
Loading history...
269
        );
270
    }
271
272
    /**
273
     * Deletes a domain from an environment.
274
     *
275
     * @param string $environmentUuid
276
     * @param string $domain
277
     * @return OperationResponse
278
     */
279
    public function deleteDomain($environmentUuid, $domain)
280
    {
281
        return new OperationResponse(
282
            $this->client->request('delete', "/environments/${environmentUuid}/domains/${domain}")
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...id.'/domains/'.$domain) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

282
            /** @scrutinizer ignore-type */ $this->client->request('delete', "/environments/${environmentUuid}/domains/${domain}")
Loading history...
283
        );
284
    }
285
286
    /**
287
     * Purges varnish for selected domains in an environment.
288
     *
289
     * @param string $environmentUuid
290
     * @param array  $domains
291
     * @return OperationResponse
292
     */
293
    public function purgeVarnishCache($environmentUuid, array $domains)
294
    {
295
296
        $options = [
297
            'form_params' => [
298
                'domains' => $domains,
299
            ],
300
        ];
301
302
        return new OperationResponse(
303
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...ear-varnish', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

303
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
304
                'post',
305
                "/environments/${environmentUuid}/domains/actions/clear-varnish",
306
                $options
307
            )
308
        );
309
    }
310
311
    /**
312
     * Gets information about an environment.
313
     *
314
     * @param string $environmentUuid
315
     * @return EnvironmentResponse
316
     */
317
    public function getEnvironment($environmentUuid)
318
    {
319
        return new EnvironmentResponse(
320
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...nts/'.$environmentUuid) can also be of type array; however, parameter $environment of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

320
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
321
                'get',
322
                "/environments/${environmentUuid}"
323
            )
324
        );
325
    }
326
327
    /**
328
     * Modifies configuration settings for an environment.
329
     *
330
     * @param string $environmentUuid
331
     * @param array $config
332
     * @return OperationResponse
333
     */
334
    public function modifyEnvironment($environmentUuid, array $config)
335
    {
336
337
        $options = [
338
          'form_params' => $config,
339
        ];
340
341
        return new OperationResponse(
342
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...ironmentUuid, $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

342
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
343
                'put',
344
                "/environments/${environmentUuid}",
345
                $options
346
            )
347
        );
348
    }
349
350
    /**
351
     * Renames an environment.
352
     *
353
     * @param string $environmentUuid
354
     * @param string $label
355
     * @return OperationResponse
356
     */
357
    public function renameEnvironment($environmentUuid, $label)
358
    {
359
360
        $options = [
361
            'form_params' => [
362
                'label' => $label,
363
            ],
364
        ];
365
366
        return new OperationResponse(
367
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...hange-label', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

367
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
368
                'post',
369
                "/environments/${environmentUuid}/actions/change-label",
370
                $options
371
            )
372
        );
373
    }
374
375
    /**
376
     * Show all servers associated with an environment.
377
     *
378
     * @param string $environmentUuid
379
     * @return ServersResponse
380
     */
381
    public function getServers($environmentUuid)
382
    {
383
        return new ServersResponse(
384
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...ronmentUuid.'/servers') can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $servers of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

384
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
385
                'get',
386
                "/environments/${environmentUuid}/servers"
387
            )
388
        );
389
    }
390
391
    /**
392
     * Enable livedev mode for an environment.
393
     *
394
     * @param string $environmentUuid
395
     * @return OperationResponse
396
     */
397
    public function enableLiveDev($environmentUuid)
398
    {
399
        return new OperationResponse(
400
            $this->client->request('post', "/environments/${environmentUuid}/livedev/actions/enable")
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...ivedev/actions/enable') can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

400
            /** @scrutinizer ignore-type */ $this->client->request('post', "/environments/${environmentUuid}/livedev/actions/enable")
Loading history...
401
        );
402
    }
403
404
    /**
405
     * Disable livedev mode for an environment.
406
     *
407
     * @param string $environmentUuid
408
     * @return OperationResponse
409
     */
410
    public function disableLiveDev($environmentUuid)
411
    {
412
413
        $options = [
414
            'form_params' => [
415
                'discard' => 1,
416
            ],
417
        ];
418
419
        return new OperationResponse(
420
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...ons/disable', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

420
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
421
                'post',
422
                "/environments/${environmentUuid}/livedev/actions/disable",
423
                $options
424
            )
425
        );
426
    }
427
428
    /**
429
     * Enable production mode for an environment.
430
     *
431
     * @param string $environmentUuid
432
     * @return OperationResponse
433
     */
434
    public function enableProductionMode($environmentUuid)
435
    {
436
        return new OperationResponse(
437
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...n-mode/actions/enable') can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

437
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
438
                'post',
439
                "/environments/${environmentUuid}/production-mode/actions/enable"
440
            )
441
        );
442
    }
443
444
    /**
445
     * Disable production mode for an environment.
446
     *
447
     * @param string $environmentUuid
448
     * @return OperationResponse
449
     */
450
    public function disableProductionMode($environmentUuid)
451
    {
452
        return new OperationResponse(
453
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...-mode/actions/disable') can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

453
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
454
                'post',
455
                "/environments/${environmentUuid}/production-mode/actions/disable"
456
            )
457
        );
458
    }
459
460
    /**
461
     * Show all cron tasks for an environment.
462
     *
463
     * @param string $environmentUuid The environment ID
464
     * @return CronsResponse
465
     */
466
    public function getCrons($environmentUuid)
467
    {
468
        return new CronsResponse(
469
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...vironmentUuid.'/crons') can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $crons of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

469
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
470
                'get',
471
                "/environments/${environmentUuid}/crons"
472
            )
473
        );
474
    }
475
476
    /**
477
     * Get information about a cron task.
478
     *
479
     * @param string $environmentUuid The environment ID
480
     * @param int    $cronId
481
     * @return CronResponse
482
     */
483
    public function getCron($environmentUuid, $cronId)
484
    {
485
        return new CronResponse(
486
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...Uuid.'/crons/'.$cronId) can also be of type array; however, parameter $cron of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

486
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
487
                'get',
488
                "/environments/${environmentUuid}/crons/${cronId}"
489
            )
490
        );
491
    }
492
493
    /**
494
     * Add a cron task.
495
     *
496
     * @param string $environmentUuid
497
     * @param string $command
498
     * @param string $frequency
499
     * @param string $label
500
     * @return OperationResponse
501
     */
502
    public function createCron($environmentUuid, $command, $frequency, $label)
503
    {
504
505
        $options = [
506
            'form_params' => [
507
                'command' => $command,
508
                'frequency' => $frequency,
509
                'label' => $label,
510
            ],
511
        ];
512
513
        return new OperationResponse(
514
            $this->client->request('post', "/environments/${environmentUuid}/crons", $options)
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...uid.'/crons', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

514
            /** @scrutinizer ignore-type */ $this->client->request('post', "/environments/${environmentUuid}/crons", $options)
Loading history...
515
        );
516
    }
517
518
    /**
519
     * Delete a cron task.
520
     *
521
     * @param string $environmentUuid
522
     * @param int    $cronId
523
     * @return OperationResponse
524
     */
525
    public function deleteCron($environmentUuid, $cronId)
526
    {
527
        return new OperationResponse(
528
            $this->client->request('delete', "/environments/${environmentUuid}/crons/${cronId}")
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...Uuid.'/crons/'.$cronId) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

528
            /** @scrutinizer ignore-type */ $this->client->request('delete', "/environments/${environmentUuid}/crons/${cronId}")
Loading history...
529
        );
530
    }
531
532
    /**
533
     * Disable a cron task.
534
     *
535
     * @param string $environmentUuid
536
     * @param int    $cronId
537
     * @return OperationResponse
538
     */
539
    public function disableCron($environmentUuid, $cronId)
540
    {
541
        return new OperationResponse(
542
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...nId.'/actions/disable') can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

542
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
543
                'post',
544
                "/environments/${environmentUuid}/crons/${cronId}/actions/disable"
545
            )
546
        );
547
    }
548
549
    /**
550
     * Enable a cron task.
551
     *
552
     * @param string $environmentUuid
553
     * @param int    $cronId
554
     * @return OperationResponse
555
     */
556
    public function enableCron($environmentUuid, $cronId)
557
    {
558
        return new OperationResponse(
559
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...onId.'/actions/enable') can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

559
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
560
                'post',
561
                "/environments/${environmentUuid}/crons/${cronId}/actions/enable"
562
            )
563
        );
564
    }
565
566
    /**
567
     * Show insights data from a specific environment.
568
     *
569
     * @param string $environmentUuid
570
     * @return InsightsResponse
571
     */
572
    public function getInsights($environmentUuid)
573
    {
574
        return new InsightsResponse(
575
            $this->client->request('get', "/environments/${environmentUuid}/insight")
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...ronmentUuid.'/insight') can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $insights of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

575
            /** @scrutinizer ignore-type */ $this->client->request('get', "/environments/${environmentUuid}/insight")
Loading history...
576
        );
577
    }
578
}
579