Passed
Push — master ( 7e1372...a56982 )
by Raza
01:31
created

ProductFamilies   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 50
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A product_family_create() 0 11 1
A product_families_list() 0 7 1
A product_family_details() 0 7 1
1
<?php
2
3
namespace Srmklive\Chargify\Traits\ChargifyAPI;
4
5
trait ProductFamilies
6
{
7
    /**
8
     * Create a product family.
9
     *
10
     * @param array $data
11
     *
12
     * @return array
13
     */
14
    public function product_family_create(array $data): array
15
    {
16
        $this->apiEndPoint = '/product_families.json';
17
18
        $this->verb = 'post';
19
20
        $this->options['json'] = [
0 ignored issues
show
Bug Best Practice introduced by
The property options does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
21
            'product_family' => $data,
22
        ];
23
24
        return $this->doChargifyRequest();
0 ignored issues
show
Bug introduced by
It seems like doChargifyRequest() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        return $this->/** @scrutinizer ignore-call */ doChargifyRequest();
Loading history...
25
    }
26
27
    /**
28
     * Get details for a product family.
29
     *
30
     * @param int $family_id
31
     *
32
     * @return array
33
     */
34
    public function product_family_details(int $family_id): array
35
    {
36
        $this->apiEndPoint = "/product_families/{$family_id}.json";
37
38
        $this->verb = 'get';
39
40
        return $this->doChargifyRequest();
41
    }
42
43
    /**
44
     * Create a product family.
45
     *
46
     * @return array
47
     */
48
    public function product_families_list(): array
49
    {
50
        $this->apiEndPoint = '/product_families.json';
51
52
        $this->verb = 'get';
53
54
        return $this->doChargifyRequest();
55
    }
56
}
57