Plugin::deleteAppScripts()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 12
loc 12
ccs 0
cts 12
cp 0
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
namespace Loevgaard\Dandomain\Api\Endpoint;
3
    
4
use Assert\Assert;
5
    
6
/**
7
 * @see http://4221117.shop53.dandomain.dk/admin/webapi/Endpoints/v1_0/PluginService.svc
8
 */
9
class Plugin extends Endpoint
10
{
11
    /**
12
     * @see https://shoppartner.dandomain.dk/dokumentation/app-developer/
13
     *
14
     * @param int $appId
15
     * @return array
16
     */
17 View Code Duplication
    public function getSiteInfo(int $appId) : array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
    {
19
        Assert::that($appId)->greaterThan(0, 'The $appId has to be positive');
20
        return (array)$this->master->doRequest(
21
            'GET',
22
            sprintf(
23
                '/admin/WEBAPI/Endpoints/v1_0/PluginService/{KEY}/SiteInfo/%s',
24
                $appId
25
            )
26
        );
27
    }
28
    
29
    /**
30
     * @see https://shoppartner.dandomain.dk/dokumentation/app-developer/
31
     *
32
     * @param int $appId
33
     * @param array\stdClass $body
34
     * @return array
35
     */
36 View Code Duplication
    public function updateAppScripts(int $appId, $body) : array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
        Assert::that($appId)->greaterThan(0, 'The $appId has to be positive');
39
        return (array)$this->master->doRequest(
40
            'POST',
41
            sprintf(
42
                '/admin/WEBAPI/Endpoints/v1_0/PluginService/{KEY}/%s/SetAppScript',
43
                $appId
44
            ),
45
            $body
46
        );
47
    }
48
49
    /**
50
     * @see https://shoppartner.dandomain.dk/dokumentation/app-developer/
51
     *
52
     * @param int $appId
53
     * @param int $pageType
54
     * @return boolean
55
     */
56 View Code Duplication
    public function deleteAppScripts(int $appId, int $pageType) : bool
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
57
    {
58
        Assert::that($appId)->greaterThan(0, 'The $appId has to be positive');
59
        return (bool)$this->master->doRequest(
60
            'DELETE',
61
            sprintf(
62
                '/admin/WEBAPI/Endpoints/v1_0/PluginService/{KEY}/DeleteAppScriptForPage?appId=%s&pageType=%s',
63
                $appId,
64
                $pageType
65
            )
66
        );
67
    }
68
}
69