Code Duplication    Length = 13-18 lines in 6 locations

src/CloudApi/Client.php 6 locations

@@ 122-139 (lines=18) @@
119
     * @param string $name
120
     * @return OperationResponse
121
     */
122
    public function renameApplication($applicationUuid, $name)
123
    {
124
125
        $options = [
126
            'form_params' => [
127
                'name' => $name,
128
            ],
129
        ];
130
131
        return new OperationResponse(
132
            $this->connector->request(
133
                'put',
134
                "/applications/${applicationUuid}",
135
                $options,
136
                $this->query
137
            )
138
        );
139
    }
140
141
    /**
142
     * Shows all code branches and tags in an application.
@@ 200-212 (lines=13) @@
197
     * @param string $environmentToUuid
198
     * @return OperationResponse
199
     */
200
    public function databaseCopy($environmentFromUuid, $dbName, $environmentToUuid)
201
    {
202
        $options = [
203
            'form_params' => [
204
                'name' => $dbName,
205
                'source' => $environmentFromUuid,
206
            ],
207
        ];
208
209
        return new OperationResponse(
210
            $this->connector->request('post', "/environments/${environmentToUuid}/databases", $this->query, $options)
211
        );
212
    }
213
214
    /**
215
     * Create a new database.
@@ 425-442 (lines=18) @@
422
     * @param array  $domains
423
     * @return OperationResponse
424
     */
425
    public function purgeVarnishCache($environmentUuid, array $domains)
426
    {
427
428
        $options = [
429
            'form_params' => [
430
                'domains' => $domains,
431
            ],
432
        ];
433
434
        return new OperationResponse(
435
            $this->connector->request(
436
                'post',
437
                "/environments/${environmentUuid}/domains/actions/clear-varnish",
438
                $this->query,
439
                $options
440
            )
441
        );
442
    }
443
444
    /**
445
     * Shows all tasks in an application.
@@ 654-668 (lines=15) @@
651
     * @param string $label
652
     * @return OperationResponse
653
     */
654
    public function createCron($environmentUuid, $command, $frequency, $label)
655
    {
656
657
        $options = [
658
            'form_params' => [
659
                'command' => $command,
660
                'frequency' => $frequency,
661
                'label' => $label,
662
            ],
663
        ];
664
665
        return new OperationResponse(
666
            $this->connector->request('post', "/environments/${environmentUuid}/crons", $this->query, $options)
667
        );
668
    }
669
670
    /**
671
     * Delete a cron task.
@@ 816-829 (lines=14) @@
813
     * @param null|string $description
814
     * @return OperationResponse
815
     */
816
    public function createRole($organizationUuid, $name, array $permissions, $description = null)
817
    {
818
        $options = [
819
            'form_params' => [
820
                'name' => $name,
821
                'permissions' => $permissions,
822
                'description' => $description,
823
            ],
824
        ];
825
826
        return new OperationResponse(
827
            $this->connector->request('post', "/organizations/${organizationUuid}/roles", $this->query, $options)
828
        );
829
    }
830
831
    /**
832
     * @param string $roleUuid
@@ 940-952 (lines=13) @@
937
     * @param array  $roles
938
     * @return OperationResponse
939
     */
940
    public function createTeamInvite($teamUuid, $email, $roles)
941
    {
942
        $options = [
943
            'form_params' => [
944
                'email' => $email,
945
                'roles' => $roles
946
            ],
947
        ];
948
949
        return new OperationResponse(
950
            $this->connector->request('post', "/teams/${teamUuid}/invites", $options)
951
        );
952
    }
953
954
    /**
955
     * Invites a user to become admin of an organization.