Completed
Push — feature/YP-3231 ( d02330...671c7e )
by Bruno
02:51
created

HostedPage   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 37
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A listHostedPages() 0 6 1
A createSubscription() 0 6 1
A updateSubscription() 0 6 1
A updateCard() 0 6 1
A buyOneTimeAddon() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Zoho\Subscription\Api;
5
6
use Zoho\Subscription\Client\Client;
7
8
class HostedPage extends Client
9
{
10
    public function listHostedPages(): array
11
    {
12
        $response = $this->sendRequest('GET', 'hostedpages', ['content-type' => 'application/json'], json_encode($data));
0 ignored issues
show
Bug introduced by
The variable $data does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
13
14
        return $this->processResponse($response);
15
    }
16
17
    public function createSubscription(array $data): array
18
    {
19
        $response = $this->sendRequest('POST', 'hostedpages/newsubscription', ['content-type' => 'application/json'], json_encode($data));
20
21
        return $this->processResponse($response);
22
    }
23
24
    public function updateSubscription(array $data): array
25
    {
26
        $response = $this->sendRequest('POST', 'hostedpages/updatesubscription', ['content-type' => 'application/json'], json_encode($data));
27
28
        return $this->processResponse($response);
29
    }
30
31
    public function updateCard(array $data): array
32
    {
33
        $response = $this->sendRequest('POST', 'hostedpages/updatecard', ['content-type' => 'application/json'], json_encode($data));
34
35
        return $this->processResponse($response);
36
    }
37
38
    public function buyOneTimeAddon(array $data): array
39
    {
40
        $response = $this->sendRequest('POST', 'hostedpages/buyonetimeaddon', ['content-type' => 'application/json'], json_encode($data));
41
42
        return $this->processResponse($response);
43
    }
44
}
45