CableTv::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
/**
3
 * Created By: Henry Ejemuta
4
 * PC: Enrico Systems
5
 * Project: laravel-clubkonnect
6
 * Company: Stimolive Technologies Limited
7
 * Class Name: Transaction.php
8
 * Date Created: 5/14/21
9
 * Time Created: 10:24 AM
10
 */
11
12
namespace HenryEjemuta\LaravelClubKonnect;
13
14
use HenryEjemuta\LaravelClubKonnect\Classes\ClubKonnectResponse;
15
use HenryEjemuta\LaravelClubKonnect\Enums\CableTvEnum;
16
use HenryEjemuta\LaravelClubKonnect\Exceptions\ClubKonnectErrorException;
17
18 View Code Duplication
abstract class CableTv
0 ignored issues
show
Duplication introduced by
This class 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...
19
{
20
    private $config;
21
    private $clubKonnect;
22
23
    public function __construct(ClubKonnect $clubKonnect, $config)
24
    {
25
        $this->config = $config;
26
        $this->clubKonnect = $clubKonnect;
27
    }
28
29
    /**
30
     * @return ClubKonnectResponse
31
     */
32
    public function getTvPackages(): ClubKonnectResponse
33
    {
34
        return $this->clubKonnect->withAuth('APICableTVPackagesV2.asp', []);
35
    }
36
37
    /**
38
     * @param CableTvEnum $cableTv
39
     * @param $smartCardNo
40
     * @return ClubKonnectResponse
41
     */
42
    public function verifyCustomerID(CableTvEnum $cableTv, $smartCardNo): ClubKonnectResponse
43
    {
44
        return $this->clubKonnect->withAuth('APIVerifyCableTVV1.0.asp', [
45
            'CableTV' => $cableTv->getCode(),
46
            'SmartCardNo' => $smartCardNo,
47
        ]);
48
    }
49
50
    /**
51
     * @param CableTvEnum $cableTv
52
     * @param string $package
53
     * @param $smartCardNo
54
     * @param $requestID
55
     * @param $callbackUrl
56
     * @return ClubKonnectResponse
57
     */
58
    public function purchasePackage(CableTvEnum $cableTv, string $package, $smartCardNo, $requestID, $callbackUrl = null): ClubKonnectResponse
59
    {
60
        $callbackUrl = is_null($callbackUrl) ? $this->config['default_redirect_url'] : $callbackUrl;
61
        return $this->clubKonnect->withAuth('APICableTVV1.asp', [
62
            'CableTV' => $cableTv->getCode(),
63
            'MeterType' => $package,
64
            'SmartCardNo' => $smartCardNo,
65
            'RequestID' => $requestID,
66
            'CallBackURL' => $callbackUrl
67
        ]);
68
    }
69
70
71
72
73
}
74