Code Duplication    Length = 10-10 lines in 4 locations

src/Gecharl.php 4 locations

@@ 117-126 (lines=10) @@
114
     * @return GecharlResponse
115
     * @throws GecharlErrorException
116
     */
117
    public function purchaseDataBundle(string $network, string $plan, string $recipient): GecharlResponse
118
    {
119
        $endpoint = "{$this->baseUrl}/data?network=$network&plan=$plan&recipent=$recipient";
120
        $response = $this->withOAuth2()->get($endpoint);
121
122
        $responseObject = json_decode($response->body());
123
        if ($response->successful())
124
            return new GecharlResponse($responseObject->status_code, $responseObject->message);
125
        return new GecharlResponse(504);
126
    }
127
128
    /**
129
     * You need to verify your meter number before purchasing.
@@ 149-158 (lines=10) @@
146
     * @return GecharlResponse
147
     * @throws GecharlErrorException
148
     */
149
    public function verifyMeterNumber(string $disco, string $meterNumber, string $meterType): GecharlResponse
150
    {
151
        $endpoint = "{$this->baseUrl}/electricity/validate/$disco/?meter_number=$meterNumber&meter_type=$meterType";
152
        $response = $this->withOAuth2()->get($endpoint);
153
154
        $responseObject = json_decode($response->body());
155
        if ($response->successful())
156
            return new GecharlResponse($responseObject->status_code, $responseObject->message);
157
        return new GecharlResponse(504);
158
    }
159
160
    /**
161
     * Purchase Electricity
@@ 207-216 (lines=10) @@
204
     * @return GecharlResponse
205
     * @throws GecharlErrorException
206
     */
207
    public function verifySmartCardNumber(string $multichoiceType, string $smartCardNumber): GecharlResponse
208
    {
209
        $endpoint = "{$this->baseUrl}/validate/multichoice?multichoice_type=$multichoiceType&smart_card_no=$smartCardNumber";
210
        $response = $this->withOAuth2()->get($endpoint);
211
212
        $responseObject = json_decode($response->body());
213
        if ($response->successful())
214
            return new GecharlResponse($responseObject->status_code, $responseObject->message);
215
        return new GecharlResponse(504);
216
    }
217
218
    /**
219
     * Purchase DSTV or GoTv Cable Tv Plan
@@ 261-270 (lines=10) @@
258
     * @return GecharlResponse
259
     * @throws GecharlErrorException
260
     */
261
    public function verifyStarTimesSmartCardNumber(string $smartCardNumber): GecharlResponse
262
    {
263
        $endpoint = "{$this->baseUrl}/validate/startimes?smart_card_no=$smartCardNumber";
264
        $response = $this->withOAuth2()->get($endpoint);
265
266
        $responseObject = json_decode($response->body());
267
        if ($response->successful())
268
            return new GecharlResponse($responseObject->status_code, $responseObject->message);
269
        return new GecharlResponse(504);
270
    }
271
272
    /**
273
     * Purchase StarTimes Cable Tv Plan