RelatedData   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 92
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 3
dl 0
loc 92
ccs 0
cts 27
cp 0
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getManufacturers() 0 4 1
A getPeriods() 0 4 1
A getProductTypes() 0 4 1
A getSegments() 0 4 1
A getSegmentsForSite() 0 9 1
A getUnits() 0 4 1
A getUnitsForSite() 0 9 1
A getVariantGroups() 0 4 1
A getVariantGroupsForSite() 0 9 1
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/RelatedDataService/help
8
 */
9
class RelatedData extends Endpoint
10
{
11
    /**
12
     * @return array
13
     */
14
    public function getManufacturers() : array
15
    {
16
        return (array)$this->master->doRequest('GET', '/admin/WEBAPI/Endpoints/v1_0/RelatedDataService/{KEY}/Manufacturers');
17
    }
18
19
    /**
20
     * @return array
21
     */
22
    public function getPeriods() : array
23
    {
24
        return (array)$this->master->doRequest('GET', '/admin/WEBAPI/Endpoints/v1_0/RelatedDataService/{KEY}/Periods');
25
    }
26
27
    /**
28
     * @return array
29
     */
30
    public function getProductTypes() : array
31
    {
32
        return (array)$this->master->doRequest('GET', '/admin/WEBAPI/Endpoints/v1_0/RelatedDataService/{KEY}/ProductTypes');
33
    }
34
35
    /**
36
     * @return array
37
     */
38
    public function getSegments() : array
39
    {
40
        return (array)$this->master->doRequest('GET', '/admin/WEBAPI/Endpoints/v1_0/RelatedDataService/{KEY}/Segments');
41
    }
42
43
    /**
44
     * @param int $siteId
45
     * @return array
46
     */
47
    public function getSegmentsForSite(int $siteId) : array
48
    {
49
        Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive');
50
51
        return (array)$this->master->doRequest(
52
            'GET',
53
            sprintf('/admin/WEBAPI/Endpoints/v1_0/RelatedDataService/{KEY}/Segments/%d', $siteId)
54
        );
55
    }
56
57
    /**
58
     * @return array
59
     */
60
    public function getUnits() : array
61
    {
62
        return (array)$this->master->doRequest('GET', '/admin/WEBAPI/Endpoints/v1_0/RelatedDataService/{KEY}/Units');
63
    }
64
65
    /**
66
     * @param int $siteId
67
     * @return array
68
     */
69
    public function getUnitsForSite(int $siteId) : array
70
    {
71
        Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive');
72
73
        return (array)$this->master->doRequest(
74
            'GET',
75
            sprintf('/admin/WEBAPI/Endpoints/v1_0/RelatedDataService/{KEY}/Units/%d', $siteId)
76
        );
77
    }
78
79
    /**
80
     * @return array
81
     */
82
    public function getVariantGroups() : array
83
    {
84
        return (array)$this->master->doRequest('GET', '/admin/WEBAPI/Endpoints/v1_0/RelatedDataService/{KEY}/VariantGroups');
85
    }
86
87
    /**
88
     * @param int $siteId
89
     * @return array
90
     */
91
    public function getVariantGroupsForSite(int $siteId) : array
92
    {
93
        Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive');
94
95
        return (array)$this->master->doRequest(
96
            'GET',
97
            sprintf('/admin/WEBAPI/Endpoints/v1_0/RelatedDataService/{KEY}/VariantGroups/%d', $siteId)
98
        );
99
    }
100
}
101