Code Duplication    Length = 9-12 lines in 5 locations

src/Endpoint/Customer.php 5 locations

@@ 15-23 (lines=9) @@
12
     * @param int $customerId
13
     * @return array
14
     */
15
    public function getCustomer(int $customerId) : array
16
    {
17
        Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');
18
19
        return (array)$this->master->doRequest(
20
            'GET',
21
            sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d', $customerId)
22
        );
23
    }
24
25
    /**
26
     * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomerByEmail_GET
@@ 73-82 (lines=10) @@
70
     * @param array|\stdClass $customer
71
     * @return array
72
     */
73
    public function updateCustomer(int $customerId, $customer) : array
74
    {
75
        Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');
76
77
        return (array)$this->master->doRequest(
78
            'PUT',
79
            sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d', $customerId),
80
            $customer
81
        );
82
    }
83
84
    /**
85
     * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#DeleteCustomer_DELETE
@@ 90-101 (lines=12) @@
87
     * @param int $customerId
88
     * @return boolean
89
     */
90
    public function deleteCustomer(int $customerId) : bool
91
    {
92
        Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');
93
94
        return (bool)$this->master->doRequest(
95
            'DELETE',
96
            sprintf(
97
                '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d',
98
                $customerId
99
            )
100
        );
101
    }
102
103
    /**
104
     * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomerGroups_GET
@@ 123-132 (lines=10) @@
120
     * @param array|\stdClass $customerDiscount
121
     * @return array
122
     */
123
    public function updateCustomerDiscount(int $customerId, $customerDiscount) : array
124
    {
125
        Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');
126
127
        return (array)$this->master->doRequest(
128
            'POST',
129
            sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/UpdateCustomerDiscount/%d', $customerId),
130
            $customerDiscount
131
        );
132
    }
133
134
    /**
135
     * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomerDiscountGET
@@ 140-151 (lines=12) @@
137
     * @param int $customerId
138
     * @return array
139
     */
140
    public function getCustomerDiscount(int $customerId) : array
141
    {
142
        Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');
143
144
        return (array)$this->master->doRequest(
145
            'GET',
146
            sprintf(
147
                '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/GetCustomerDiscount/%d',
148
                $customerId
149
            )
150
        );
151
    }
152
}
153