Passed
Push — master ( 9b09ed...205bed )
by Adam
02:04
created

Client::deleteRole()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AcquiaCloudApi\CloudApi;
4
5
use AcquiaCloudApi\Response\AccountResponse;
6
use AcquiaCloudApi\Response\ApplicationResponse;
7
use AcquiaCloudApi\Response\ApplicationsResponse;
8
use AcquiaCloudApi\Response\BackupResponse;
9
use AcquiaCloudApi\Response\BackupsResponse;
10
use AcquiaCloudApi\Response\BranchesResponse;
11
use AcquiaCloudApi\Response\CronResponse;
12
use AcquiaCloudApi\Response\CronsResponse;
13
use AcquiaCloudApi\Response\DatabasesResponse;
14
use AcquiaCloudApi\Response\DomainResponse;
15
use AcquiaCloudApi\Response\DomainsResponse;
16
use AcquiaCloudApi\Response\EnvironmentResponse;
17
use AcquiaCloudApi\Response\EnvironmentsResponse;
18
use AcquiaCloudApi\Response\InsightsResponse;
19
use AcquiaCloudApi\Response\InvitationsResponse;
20
use AcquiaCloudApi\Response\MembersResponse;
21
use AcquiaCloudApi\Response\OperationResponse;
22
use AcquiaCloudApi\Response\OrganizationsResponse;
23
use AcquiaCloudApi\Response\PermissionsResponse;
24
use AcquiaCloudApi\Response\RolesResponse;
25
use AcquiaCloudApi\Response\ServersResponse;
26
use AcquiaCloudApi\Response\TasksResponse;
27
use AcquiaCloudApi\Response\TeamsResponse;
28
use Psr\Http\Message\StreamInterface;
29
30
/**
31
 * Class Client
32
 * @package AcquiaCloudApi\CloudApi
33
 */
34
class Client implements ClientInterface
35
{
36
    /** @var ConnectorInterface The API connector. */
37
    protected $connector;
38
39
    /** @var array Query strings to be applied to the request. */
40
    protected $query = [];
41
42
    /**
43
     * Client constructor.
44
     *
45
     * @param ConnectorInterface $connector
46
     */
47
    public function __construct(ConnectorInterface $connector)
48
    {
49
        $this->connector = $connector;
50
    }
51
52
    /**
53
     * Client factory method for instantiating .
54
     *
55
     * @param ConnectorInterface $connector
56
     *
57
     * @return static
58
     */
59
    public static function factory(ConnectorInterface $connector)
60
    {
61
        $client = new static(
62
            $connector
63
        );
64
65
        return $client;
66
    }
67
68
    /**
69
     * Get query from Client.
70
     *
71
     * @return array
72
     */
73
    public function getQuery()
74
    {
75
        return $this->query;
76
    }
77
78
    /**
79
     * Clear query.
80
     */
81
    public function clearQuery()
82
    {
83
        $this->query = [];
84
    }
85
86
    /**
87
     * Add a query parameter to filter results.
88
     *
89
     * @param string $name
90
     * @param string $value
91
     */
92
    public function addQuery($name, $value)
93
    {
94
        $this->query = array_merge_recursive($this->query, [$name => $value]);
95
    }
96
97
    /**
98
     * Returns details about your account.
99
     *
100
     * @return AccountResponse
101
     */
102
    public function account()
103
    {
104
        return new AccountResponse($this->connector->request('get', '/account', $this->query));
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...account', $this->query) can also be of type array; however, parameter $account 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

104
        return new AccountResponse(/** @scrutinizer ignore-type */ $this->connector->request('get', '/account', $this->query));
Loading history...
105
    }
106
107
    /**
108
     * Shows all applications.
109
     *
110
     * @return ApplicationsResponse
111
     */
112
    public function applications()
113
    {
114
        return new ApplicationsResponse($this->connector->request('get', '/applications', $this->query));
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...cations', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $applications 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

114
        return new ApplicationsResponse(/** @scrutinizer ignore-type */ $this->connector->request('get', '/applications', $this->query));
Loading history...
115
    }
116
117
    /**
118
     * Shows information about an application.
119
     *
120
     * @param string $applicationUuid
121
     * @return ApplicationResponse
122
     */
123
    public function application($applicationUuid)
124
    {
125
        return new ApplicationResponse(
126
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...tionUuid, $this->query) can also be of type array; however, parameter $application 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

126
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
127
                'get',
128
                "/applications/${applicationUuid}",
129
                $this->query
130
            )
131
        );
132
    }
133
134
    /**
135
     * Renames an application.
136
     *
137
     * @param string $applicationUuid
138
     * @param string $name
139
     * @return OperationResponse
140
     */
141
    public function renameApplication($applicationUuid, $name)
142
    {
143
144
        $options = [
145
            'form_params' => [
146
                'name' => $name,
147
            ],
148
        ];
149
150
        return new OperationResponse(
151
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$options, $this->query) 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

151
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
152
                'put',
153
                "/applications/${applicationUuid}",
154
                $options,
155
                $this->query
156
            )
157
        );
158
    }
159
160
    /**
161
     * Shows all code branches and tags in an application.
162
     *
163
     * @param string $applicationUuid
164
     * @return BranchesResponse
165
     */
166
    public function code($applicationUuid)
167
    {
168
        return new BranchesResponse(
169
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques....'/code', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $branches 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

169
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
170
                'get',
171
                "/applications/${applicationUuid}/code",
172
                $this->query
173
            )
174
        );
175
    }
176
177
    /**
178
     * Shows all databases in an application.
179
     *
180
     * @param string $applicationUuid
181
     * @return DatabasesResponse
182
     */
183
    public function databases($applicationUuid)
184
    {
185
        return new DatabasesResponse(
186
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...tabases', $this->query) 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

186
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
187
                'get',
188
                "/applications/${applicationUuid}/databases",
189
                $this->query
190
            )
191
        );
192
    }
193
194
    /**
195
     * Shows all databases in an environment.
196
     *
197
     * @param string $environmentUuid
198
     * @return DatabasesResponse
199
     */
200
    public function environmentDatabases($environmentUuid)
201
    {
202
        return new DatabasesResponse(
203
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...tabases', $this->query) 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

203
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
204
                'get',
205
                "/environments/${environmentUuid}/databases",
206
                $this->query
207
            )
208
        );
209
    }
210
211
    /**
212
     * Copies a database from an environment to an environment.
213
     *
214
     * @param string $environmentFromUuid
215
     * @param string $dbName
216
     * @param string $environmentToUuid
217
     * @return OperationResponse
218
     */
219
    public function databaseCopy($environmentFromUuid, $dbName, $environmentToUuid)
220
    {
221
        $options = [
222
            'form_params' => [
223
                'name' => $dbName,
224
                'source' => $environmentFromUuid,
225
            ],
226
        ];
227
228
        return new OperationResponse(
229
            $this->connector->request('post', "/environments/${environmentToUuid}/databases", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

229
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/environments/${environmentToUuid}/databases", $this->query, $options)
Loading history...
230
        );
231
    }
232
233
    /**
234
     * Create a new database.
235
     *
236
     * @param string $applicationUuid
237
     * @param string $name
238
     * @return OperationResponse
239
     */
240
    public function databaseCreate($applicationUuid, $name)
241
    {
242
        $options = [
243
            'form_params' => [
244
                'name' => $name,
245
            ],
246
        ];
247
248
        return new OperationResponse(
249
            $this->connector->request('post', "/applications/${applicationUuid}/databases", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

249
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/applications/${applicationUuid}/databases", $this->query, $options)
Loading history...
250
        );
251
    }
252
253
    /**
254
     * Delete a database.
255
     *
256
     * @param string $applicationUuid
257
     * @param string $name
258
     * @return OperationResponse
259
     */
260
    public function databaseDelete($applicationUuid, $name)
261
    {
262
        return new OperationResponse(
263
            $this->connector->request('delete', "/applications/${applicationUuid}/databases/${name}", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques.../'.$name, $this->query) 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

263
            /** @scrutinizer ignore-type */ $this->connector->request('delete', "/applications/${applicationUuid}/databases/${name}", $this->query)
Loading history...
264
        );
265
    }
266
267
    /**
268
     * Backup a database.
269
     *
270
     * @param string $environmentUuid
271
     * @param string $dbName
272
     * @return OperationResponse
273
     */
274
    public function createDatabaseBackup($environmentUuid, $dbName)
275
    {
276
        return new OperationResponse(
277
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...backups', $this->query) 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

277
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
278
                'post',
279
                "/environments/${environmentUuid}/databases/${dbName}/backups",
280
                $this->query
281
            )
282
        );
283
    }
284
285
    /**
286
     * Shows all database backups in an environment.
287
     *
288
     * @param string $environmentUuid
289
     * @param string $dbName
290
     * @return BackupsResponse
291
     */
292
    public function databaseBackups($environmentUuid, $dbName)
293
    {
294
        return new BackupsResponse(
295
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...backups', $this->query) 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

295
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
296
                'get',
297
                "/environments/${environmentUuid}/databases/${dbName}/backups",
298
                $this->query
299
            )
300
        );
301
    }
302
303
    /**
304
     * Gets information about a database backup.
305
     *
306
     * @param string $environmentUuid
307
     * @param string $dbName
308
     * @param int    $backupId
309
     * @return BackupResponse
310
     */
311
    public function databaseBackup($environmentUuid, $dbName, $backupId)
312
    {
313
        return new BackupResponse(
314
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...backupId, $this->query) 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

314
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
315
                'get',
316
                "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}",
317
                $this->query
318
            )
319
        );
320
    }
321
322
    /**
323
     * Restores a database backup to a database in an environment.
324
     *
325
     * @param string $environmentUuid
326
     * @param string $dbName
327
     * @param int    $backupId
328
     * @return OperationResponse
329
     */
330
    public function restoreDatabaseBackup($environmentUuid, $dbName, $backupId)
331
    {
332
        return new OperationResponse(
333
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...restore', $this->query) 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

333
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
334
                'post',
335
                "/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}/actions/restore",
336
                $this->query
337
            )
338
        );
339
    }
340
341
    /**
342
     * Copies files from an environment to another environment.
343
     *
344
     * @param string $environmentUuidFrom
345
     * @param string $environmentUuidTo
346
     * @return OperationResponse
347
     */
348
    public function copyFiles($environmentUuidFrom, $environmentUuidTo)
349
    {
350
        $options = [
351
            'form_params' => [
352
                'source' => $environmentUuidFrom,
353
            ],
354
        ];
355
356
        return new OperationResponse(
357
            $this->connector->request('post', "/environments/${environmentUuidTo}/files", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

357
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/environments/${environmentUuidTo}/files", $this->query, $options)
Loading history...
358
        );
359
    }
360
361
    /**
362
     * Deploys a code branch/tag to an environment.
363
     *
364
     * @param string $environmentUuid
365
     * @param string $branch
366
     * @return OperationResponse
367
     */
368
    public function switchCode($environmentUuid, $branch)
369
    {
370
371
        $options = [
372
            'form_params' => [
373
                'branch' => $branch,
374
            ],
375
        ];
376
377
        return new OperationResponse(
378
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

378
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
379
                'post',
380
                "/environments/${environmentUuid}/code/actions/switch",
381
                $this->query,
382
                $options
383
            )
384
        );
385
    }
386
387
    /**
388
     * Deploys code from one environment to another environment.
389
     *
390
     * @param string $environmentFromUuid
391
     * @param string $environmentToUuid
392
     * @param string $commitMessage
393
     */
394
    public function deployCode($environmentFromUuid, $environmentToUuid, $commitMessage = null)
395
    {
396
397
        $options = [
398
            'form_params' => [
399
                'source' => $environmentFromUuid,
400
                'message' => $commitMessage,
401
            ],
402
        ];
403
404
        return new OperationResponse(
405
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

405
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
406
                'post',
407
                "/environments/${environmentToUuid}/code",
408
                $this->query,
409
                $options
410
            )
411
        );
412
    }
413
414
    /**
415
     * Shows all domains on an environment.
416
     *
417
     * @param string $environmentUuid
418
     * @return DomainsResponse
419
     */
420
    public function domains($environmentUuid)
421
    {
422
        return new DomainsResponse(
423
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...domains', $this->query) 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

423
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
424
                'get',
425
                "/environments/${environmentUuid}/domains",
426
                $this->query
427
            )
428
        );
429
    }
430
431
    /**
432
     * Return details about a domain.
433
     *
434
     * @param string $environmentUuid
435
     * @param string $domain
436
     * @return DomainResponse
437
     */
438
    public function domain($environmentUuid, $domain)
439
    {
440
        return new DomainResponse(
441
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques....$domain, $this->query) 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

441
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
442
                'get',
443
                "/environments/${environmentUuid}/domains/${domain}",
444
                $this->query
445
            )
446
        );
447
    }
448
449
    /**
450
     * Adds a domain to an environment.
451
     *
452
     * @param string $environmentUuid
453
     * @param string $hostname
454
     * @return OperationResponse
455
     */
456
    public function createDomain($environmentUuid, $hostname)
457
    {
458
459
        $options = [
460
            'form_params' => [
461
                'hostname' => $hostname,
462
            ],
463
        ];
464
465
        return new OperationResponse(
466
            $this->connector->request('post', "/environments/${environmentUuid}/domains", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

466
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/environments/${environmentUuid}/domains", $this->query, $options)
Loading history...
467
        );
468
    }
469
470
    /**
471
     * Deletes a domain from an environment.
472
     *
473
     * @param string $environmentUuid
474
     * @param string $domain
475
     * @return OperationResponse
476
     */
477
    public function deleteDomain($environmentUuid, $domain)
478
    {
479
        return new OperationResponse(
480
            $this->connector->request('delete', "/environments/${environmentUuid}/domains/${domain}", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques....$domain, $this->query) 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

480
            /** @scrutinizer ignore-type */ $this->connector->request('delete', "/environments/${environmentUuid}/domains/${domain}", $this->query)
Loading history...
481
        );
482
    }
483
484
    /**
485
     * Purges varnish for selected domains in an environment.
486
     *
487
     * @param string $environmentUuid
488
     * @param array  $domains
489
     * @return OperationResponse
490
     */
491
    public function purgeVarnishCache($environmentUuid, array $domains)
492
    {
493
494
        $options = [
495
            'form_params' => [
496
                'domains' => $domains,
497
            ],
498
        ];
499
500
        return new OperationResponse(
501
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

501
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
502
                'post',
503
                "/environments/${environmentUuid}/domains/actions/clear-varnish",
504
                $this->query,
505
                $options
506
            )
507
        );
508
    }
509
510
    /**
511
     * Shows all tasks in an application.
512
     *
513
     * @param string $applicationUuid
514
     * @return TasksResponse
515
     */
516
    public function tasks($applicationUuid)
517
    {
518
        return new TasksResponse(
519
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...'/tasks', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $tasks 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

519
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
520
                'get',
521
                "/applications/${applicationUuid}/tasks",
522
                $this->query
523
            )
524
        );
525
    }
526
527
    /**
528
     * Shows all environments in an application.
529
     *
530
     * @param string $applicationUuid
531
     * @return EnvironmentsResponse
532
     */
533
    public function environments($applicationUuid)
534
    {
535
        return new EnvironmentsResponse(
536
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...onments', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $environments 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

536
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
537
                'get',
538
                "/applications/${applicationUuid}/environments",
539
                $this->query
540
            )
541
        );
542
    }
543
544
    /**
545
     * Gets information about an environment.
546
     *
547
     * @param string $environmentUuid
548
     * @return EnvironmentResponse
549
     */
550
    public function environment($environmentUuid)
551
    {
552
        return new EnvironmentResponse(
553
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...mentUuid, $this->query) 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

553
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
554
                'get',
555
                "/environments/${environmentUuid}",
556
                $this->query
557
            )
558
        );
559
    }
560
561
    /**
562
     * Modifies configuration settings for an environment.
563
     *
564
     * @param string $environmentUuid
565
     * @param array $config
566
     * @return EnvironmentResponse
567
     */
568
    public function modifyEnvironment($environmentUuid, array $config)
569
    {
570
571
        $options = [
572
          'form_params' => $config,
573
        ];
574
575
        return new OperationResponse(
0 ignored issues
show
Bug Best Practice introduced by
The expression return new AcquiaCloudAp...this->query, $options)) returns the type AcquiaCloudApi\Response\OperationResponse which is incompatible with the documented return type AcquiaCloudApi\Response\EnvironmentResponse.
Loading history...
576
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

576
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
577
                'put',
578
                "/environments/${environmentUuid}",
579
                $this->query,
580
                $options
581
            )
582
        );
583
    }
584
585
    /**
586
     * Renames an environment.
587
     *
588
     * @param string $environmentUuid
589
     * @param string $label
590
     * @return OperationResponse
591
     */
592
    public function renameEnvironment($environmentUuid, $label)
593
    {
594
595
        $options = [
596
            'form_params' => [
597
                'label' => $label,
598
            ],
599
        ];
600
601
        return new OperationResponse(
602
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

602
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
603
                'post',
604
                "/environments/${environmentUuid}/actions/change-label",
605
                $this->query,
606
                $options
607
            )
608
        );
609
    }
610
611
    /**
612
     * Show all servers associated with an environment.
613
     *
614
     * @param string $environmentUuid
615
     * @return ServersResponse
616
     */
617
    public function servers($environmentUuid)
618
    {
619
        return new ServersResponse(
620
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...servers', $this->query) 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

620
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
621
                'get',
622
                "/environments/${environmentUuid}/servers",
623
                $this->query
624
            )
625
        );
626
    }
627
628
    /**
629
     * Enable livedev mode for an environment.
630
     *
631
     * @param string $environmentUuid
632
     * @return OperationResponse
633
     */
634
    public function enableLiveDev($environmentUuid)
635
    {
636
        return new OperationResponse(
637
            $this->connector->request('post', "/environments/${environmentUuid}/livedev/actions/enable", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques.../enable', $this->query) 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

637
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/environments/${environmentUuid}/livedev/actions/enable", $this->query)
Loading history...
638
        );
639
    }
640
641
    /**
642
     * Disable livedev mode for an environment.
643
     *
644
     * @param string $environmentUuid
645
     * @return OperationResponse
646
     */
647
    public function disableLiveDev($environmentUuid)
648
    {
649
650
        $options = [
651
            'form_params' => [
652
                'discard' => 1,
653
            ],
654
        ];
655
656
        return new OperationResponse(
657
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

657
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
658
                'post',
659
                "/environments/${environmentUuid}/livedev/actions/disable",
660
                $this->query,
661
                $options
662
            )
663
        );
664
    }
665
666
    /**
667
     * Enable production mode for an environment.
668
     *
669
     * @param string $environmentUuid
670
     * @return OperationResponse
671
     */
672
    public function enableProductionMode($environmentUuid)
673
    {
674
        return new OperationResponse(
675
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques.../enable', $this->query) 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

675
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
676
                'post',
677
                "/environments/${environmentUuid}/production-mode/actions/enable",
678
                $this->query
679
            )
680
        );
681
    }
682
683
    /**
684
     * Disable production mode for an environment.
685
     *
686
     * @param string $environmentUuid
687
     * @return OperationResponse
688
     */
689
    public function disableProductionMode($environmentUuid)
690
    {
691
        return new OperationResponse(
692
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...disable', $this->query) 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

692
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
693
                'post',
694
                "/environments/${environmentUuid}/production-mode/actions/disable",
695
                $this->query
696
            )
697
        );
698
    }
699
700
    /**
701
     * Show all cron tasks for an environment.
702
     *
703
     * @param string $environmentUuid The environment ID
704
     * @return CronsResponse
705
     */
706
    public function crons($environmentUuid)
707
    {
708
        return new CronsResponse(
709
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...'/crons', $this->query) 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

709
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
710
                'get',
711
                "/environments/${environmentUuid}/crons",
712
                $this->query
713
            )
714
        );
715
    }
716
717
    /**
718
     * Get information about a cron task.
719
     *
720
     * @param string $environmentUuid The environment ID
721
     * @param int    $cronId
722
     * @return CronResponse
723
     */
724
    public function cron($environmentUuid, $cronId)
725
    {
726
        return new CronResponse(
727
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques....$cronId, $this->query) 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

727
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
728
                'get',
729
                "/environments/${environmentUuid}/crons/${cronId}",
730
                $this->query
731
            )
732
        );
733
    }
734
735
    /**
736
     * Add a cron task.
737
     *
738
     * @param string $environmentUuid
739
     * @param string $command
740
     * @param string $frequency
741
     * @param string $label
742
     * @return OperationResponse
743
     */
744
    public function createCron($environmentUuid, $command, $frequency, $label)
745
    {
746
747
        $options = [
748
            'form_params' => [
749
                'command' => $command,
750
                'frequency' => $frequency,
751
                'label' => $label,
752
            ],
753
        ];
754
755
        return new OperationResponse(
756
            $this->connector->request('post', "/environments/${environmentUuid}/crons", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

756
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/environments/${environmentUuid}/crons", $this->query, $options)
Loading history...
757
        );
758
    }
759
760
    /**
761
     * Delete a cron task.
762
     *
763
     * @param string $environmentUuid
764
     * @param int    $cronId
765
     * @return OperationResponse
766
     */
767
    public function deleteCron($environmentUuid, $cronId)
768
    {
769
        return new OperationResponse(
770
            $this->connector->request('delete', "/environments/${environmentUuid}/crons/${cronId}", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques....$cronId, $this->query) 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

770
            /** @scrutinizer ignore-type */ $this->connector->request('delete', "/environments/${environmentUuid}/crons/${cronId}", $this->query)
Loading history...
771
        );
772
    }
773
774
    /**
775
     * Disable a cron task.
776
     *
777
     * @param string $environmentUuid
778
     * @param int    $cronId
779
     * @return OperationResponse
780
     */
781
    public function disableCron($environmentUuid, $cronId)
782
    {
783
        return new OperationResponse(
784
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...disable', $this->query) 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

784
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
785
                'post',
786
                "/environments/${environmentUuid}/crons/${cronId}/actions/disable",
787
                $this->query
788
            )
789
        );
790
    }
791
792
    /**
793
     * Enable a cron task.
794
     *
795
     * @param string $environmentUuid
796
     * @param int    $cronId
797
     * @return OperationResponse
798
     */
799
    public function enableCron($environmentUuid, $cronId)
800
    {
801
        return new OperationResponse(
802
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques.../enable', $this->query) 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

802
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
803
                'post',
804
                "/environments/${environmentUuid}/crons/${cronId}/actions/enable",
805
                $this->query
806
            )
807
        );
808
    }
809
810
    /**
811
     * Provides an archived set of files for Acquia Drush aliases.
812
     *
813
     * @return StreamInterface
814
     */
815
    public function drushAliases()
816
    {
817
        return $this->connector->request('get', '/account/drush-aliases/download', $this->query);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->connector-...ownload', $this->query) also could return the type array which is incompatible with the documented return type Psr\Http\Message\StreamInterface.
Loading history...
818
    }
819
820
    /**
821
     * Show insights data from an application.
822
     *
823
     * @param string $applicationUuid
824
     * @return InsightsResponse
825
     */
826
    public function applicationInsights($applicationUuid)
827
    {
828
        return new InsightsResponse(
829
            $this->connector->request('get', "/applications/${applicationUuid}/insight", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...insight', $this->query) 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

829
            /** @scrutinizer ignore-type */ $this->connector->request('get', "/applications/${applicationUuid}/insight", $this->query)
Loading history...
830
        );
831
    }
832
833
    /**
834
     * Show insights data from a specific environment.
835
     *
836
     * @param string $environmentUuid
837
     * @return InsightsResponse
838
     */
839
    public function environmentInsights($environmentUuid)
840
    {
841
        return new InsightsResponse(
842
            $this->connector->request('get', "/environments/${environmentUuid}/insight", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...insight', $this->query) 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

842
            /** @scrutinizer ignore-type */ $this->connector->request('get', "/environments/${environmentUuid}/insight", $this->query)
Loading history...
843
        );
844
    }
845
846
    /**
847
     * Show all organizations.
848
     *
849
     * @return OrganizationsResponse
850
     */
851
    public function organizations()
852
    {
853
        return new OrganizationsResponse($this->connector->request('get', '/organizations', $this->query));
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...zations', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $organizations 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

853
        return new OrganizationsResponse(/** @scrutinizer ignore-type */ $this->connector->request('get', '/organizations', $this->query));
Loading history...
854
    }
855
856
    /**
857
     * Show all applications in an organisation.
858
     *
859
     * @param string $organizationUuid
860
     *
861
     * @return ApplicationsResponse
862
     */
863
    public function organizationApplications($organizationUuid)
864
    {
865
        return new ApplicationsResponse(
866
            $this->connector->request('get', "/organizations/${organizationUuid}/applications", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...cations', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $applications 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

866
            /** @scrutinizer ignore-type */ $this->connector->request('get', "/organizations/${organizationUuid}/applications", $this->query)
Loading history...
867
        );
868
    }
869
870
    /**
871
     * Show all roles in an organization.
872
     *
873
     * @param string $organizationUuid
874
     * @return RolesResponse
875
     */
876
    public function organizationRoles($organizationUuid)
877
    {
878
        return new RolesResponse(
879
            $this->connector->request('get', "/organizations/${organizationUuid}/roles", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...'/roles', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $roles 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

879
            /** @scrutinizer ignore-type */ $this->connector->request('get', "/organizations/${organizationUuid}/roles", $this->query)
Loading history...
880
        );
881
    }
882
883
    /**
884
     * Update the permissions associated with a role.
885
     *
886
     * @param string $roleUuid
887
     * @param array  $permissions
888
     * @return OperationResponse
889
     */
890
    public function updateRole($roleUuid, array $permissions)
891
    {
892
        $options = [
893
            'form_params' => [
894
                'permissions' => $permissions,
895
            ],
896
        ];
897
898
        return new OperationResponse(
899
            $this->connector->request('put', "/roles/${roleUuid}", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

899
            /** @scrutinizer ignore-type */ $this->connector->request('put', "/roles/${roleUuid}", $this->query, $options)
Loading history...
900
        );
901
    }
902
903
    /**
904
     * Create a new role.
905
     *
906
     * @param string      $organizationUuid
907
     * @param string      $name
908
     * @param array       $permissions
909
     * @param null|string $description
910
     * @return OperationResponse
911
     */
912
    public function createRole($organizationUuid, $name, array $permissions, $description = null)
913
    {
914
        $options = [
915
            'form_params' => [
916
                'name' => $name,
917
                'permissions' => $permissions,
918
                'description' => $description,
919
            ],
920
        ];
921
922
        return new OperationResponse(
923
            $this->connector->request('post', "/organizations/${organizationUuid}/roles", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

923
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/organizations/${organizationUuid}/roles", $this->query, $options)
Loading history...
924
        );
925
    }
926
927
    /**
928
     * Delete a role.
929
     *
930
     * @param string $roleUuid
931
     * @return OperationResponse
932
     */
933
    public function deleteRole($roleUuid)
934
    {
935
        return new OperationResponse($this->connector->request('delete', "/roles/${roleUuid}", $this->query));
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...roleUuid, $this->query) 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

935
        return new OperationResponse(/** @scrutinizer ignore-type */ $this->connector->request('delete', "/roles/${roleUuid}", $this->query));
Loading history...
936
    }
937
938
    /**
939
     * Show all teams in an organization.
940
     *
941
     * @param string $organizationUuid
942
     * @return TeamsResponse
943
     */
944
    public function organizationTeams($organizationUuid)
945
    {
946
        return new TeamsResponse(
947
            $this->connector->request('get', "/organizations/${organizationUuid}/teams", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...'/teams', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $teams 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

947
            /** @scrutinizer ignore-type */ $this->connector->request('get', "/organizations/${organizationUuid}/teams", $this->query)
Loading history...
948
        );
949
    }
950
951
    /**
952
     * Show all teams.
953
     *
954
     * @return TeamsResponse
955
     */
956
    public function teams()
957
    {
958
        return new TeamsResponse(
959
            $this->connector->request('get', '/teams', $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...'/teams', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $teams 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

959
            /** @scrutinizer ignore-type */ $this->connector->request('get', '/teams', $this->query)
Loading history...
960
        );
961
    }
962
963
    /**
964
     * Rename an existing team.
965
     *
966
     * @param string $teamUuid
967
     * @param string $name
968
     * @return OperationResponse
969
     */
970
    public function renameTeam($teamUuid, $name)
971
    {
972
        $options = [
973
            'form_params' => [
974
                'name' => $name,
975
            ],
976
        ];
977
978
        return new OperationResponse(
979
            $this->connector->request('put', "/teams/${teamUuid}", $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques.../'.$teamUuid, $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

979
            /** @scrutinizer ignore-type */ $this->connector->request('put', "/teams/${teamUuid}", $options)
Loading history...
980
        );
981
    }
982
983
    /**
984
     * Create a new team.
985
     *
986
     * @param string $organizationUuid
987
     * @param string $name
988
     * @return OperationResponse
989
     */
990
    public function createTeam($organizationUuid, $name)
991
    {
992
        $options = [
993
            'form_params' => [
994
                'name' => $name,
995
            ],
996
        ];
997
998
        return new OperationResponse(
999
            $this->connector->request('post', "/organizations/${organizationUuid}/teams", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

999
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/organizations/${organizationUuid}/teams", $this->query, $options)
Loading history...
1000
        );
1001
    }
1002
1003
    /**
1004
     * Delete a team.
1005
     *
1006
     * @param string $teamUuid
1007
     * @return OperationResponse
1008
     */
1009
    public function deleteTeam($teamUuid)
1010
    {
1011
        return new OperationResponse(
1012
            $this->connector->request('delete', "/teams/${teamUuid}", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...teamUuid, $this->query) 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

1012
            /** @scrutinizer ignore-type */ $this->connector->request('delete', "/teams/${teamUuid}", $this->query)
Loading history...
1013
        );
1014
    }
1015
1016
    /**
1017
     * Add an application to a team.
1018
     *
1019
     * @param string $teamUuid
1020
     * @param string $applicationUuid
1021
     * @return OperationResponse
1022
     */
1023
    public function addApplicationToTeam($teamUuid, $applicationUuid)
1024
    {
1025
        $options = [
1026
            'form_params' => [
1027
                'uuid' => $applicationUuid,
1028
            ],
1029
        ];
1030
1031
        return new OperationResponse(
1032
            $this->connector->request('post', "/teams/${teamUuid}/applications", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

1032
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/teams/${teamUuid}/applications", $this->query, $options)
Loading history...
1033
        );
1034
    }
1035
1036
    /**
1037
     * Invites a user to join a team.
1038
     *
1039
     * @param string $teamUuid
1040
     * @param string $email
1041
     * @param array  $roles
1042
     * @return OperationResponse
1043
     */
1044
    public function createTeamInvite($teamUuid, $email, $roles)
1045
    {
1046
        $options = [
1047
            'form_params' => [
1048
                'email' => $email,
1049
                'roles' => $roles
1050
            ],
1051
        ];
1052
1053
        return new OperationResponse(
1054
            $this->connector->request('post', "/teams/${teamUuid}/invites", $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...d.'/invites', $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

1054
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/teams/${teamUuid}/invites", $options)
Loading history...
1055
        );
1056
    }
1057
1058
    /**
1059
     * Invites a user to become admin of an organization.
1060
     *
1061
     * @param string $organizationUuid
1062
     * @param string $email
1063
     * @return OperationResponse
1064
     */
1065
    public function createOrganizationAdminInvite($organizationUuid, $email)
1066
    {
1067
        $options = [
1068
            'form_params' => [
1069
                'email' => $email,
1070
            ],
1071
        ];
1072
1073
        return new OperationResponse(
1074
            $this->connector->request('post', "/teams/${organizationUuid}/invites", $this->query, $options)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...$this->query, $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

1074
            /** @scrutinizer ignore-type */ $this->connector->request('post', "/teams/${organizationUuid}/invites", $this->query, $options)
Loading history...
1075
        );
1076
    }
1077
1078
    /**
1079
     * Show all applications associated with a team.
1080
     *
1081
     * @param string $teamUuid
1082
     * @return ApplicationsResponse
1083
     */
1084
    public function teamApplications($teamUuid)
1085
    {
1086
        return new ApplicationsResponse(
1087
            $this->connector->request('get', "/teams/${teamUuid}/applications", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...cations', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $applications 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

1087
            /** @scrutinizer ignore-type */ $this->connector->request('get', "/teams/${teamUuid}/applications", $this->query)
Loading history...
1088
        );
1089
    }
1090
1091
    /**
1092
     * Show all members of an organisation.
1093
     *
1094
     * @param string $organizationUuid
1095
     * @return MembersResponse
1096
     */
1097
    public function members($organizationUuid)
1098
    {
1099
        return new MembersResponse(
1100
            $this->connector->request('get', "/organizations/${organizationUuid}/members", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...members', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $members 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

1100
            /** @scrutinizer ignore-type */ $this->connector->request('get', "/organizations/${organizationUuid}/members", $this->query)
Loading history...
1101
        );
1102
    }
1103
1104
    /**
1105
     * Show all members invited to an organisation.
1106
     *
1107
     * @param string $organizationUuid
1108
     * @return InvitationsResponse
1109
     */
1110
    public function invitees($organizationUuid)
1111
    {
1112
        return new InvitationsResponse(
1113
            $this->connector->request('get', "/organizations/${organizationUuid}/team-invites", $this->query)
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...invites', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $invitations 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

1113
            /** @scrutinizer ignore-type */ $this->connector->request('get', "/organizations/${organizationUuid}/team-invites", $this->query)
Loading history...
1114
        );
1115
    }
1116
1117
    /**
1118
     * Delete a member from an organisation.
1119
     *
1120
     * @param string $organizationUuid
1121
     * @param string $memberUuid
1122
     * @return OperationResponse
1123
     */
1124
    public function deleteMember($organizationUuid, $memberUuid)
1125
    {
1126
        return new OperationResponse(
1127
            $this->connector->request(
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...mberUuid, $this->query) 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

1127
            /** @scrutinizer ignore-type */ $this->connector->request(
Loading history...
1128
                'delete',
1129
                "/organizations/${organizationUuid}/members/${memberUuid}",
1130
                $this->query
1131
            )
1132
        );
1133
    }
1134
1135
    /**
1136
     * Show all available permissions.
1137
     *
1138
     * @return PermissionsResponse
1139
     */
1140
    public function permissions()
1141
    {
1142
        return new PermissionsResponse($this->connector->request('get', '/permissions', $this->query));
0 ignored issues
show
Bug introduced by
It seems like $this->connector->reques...issions', $this->query) can also be of type Psr\Http\Message\StreamInterface and object; however, parameter $permissions 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

1142
        return new PermissionsResponse(/** @scrutinizer ignore-type */ $this->connector->request('get', '/permissions', $this->query));
Loading history...
1143
    }
1144
}
1145