ListZonesResponse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 63
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOwnerJson() 0 3 1
A getPlanJson() 0 3 1
B getResultJson() 0 25 1
1
<?php declare(strict_types = 1);
2
/**
3
 *
4
 * Copyright (C) 2018  Ross Mitchell
5
 *
6
 * This file is part of RossMitchell/UpdateCloudFlare.
7
 *
8
 * RossMitchell/UpdateCloudFlare is free software: you can redistribute
9
 * it and/or modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation, either version 3 of the
11
 * License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
namespace RossMitchell\UpdateCloudFlare\Tests\Fakes\Helpers;
23
24
/**
25
 * Class ListZonesResponse - Provides a standard response for the List Zones call
26
 * @package RossMitchell\UpdateCloudFlare\Tests\Fakes\Helpers
27
 */
28
class ListZonesResponse extends AbstractCloudFlareResponse
29
{
30
    /**
31
     * @return string
32
     */
33
    public function getOwnerJson(): string
34
    {
35
        return <<<JSON
36
{
37
    "id": "7c5dae5552338874e5053f2534d2767a",
38
    "email": "[email protected]",
39
    "owner_type": "user"
40
}
41
JSON;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getPlanJson(): string
48
    {
49
        return <<<JSON
50
{
51
    "id": "e592fd9519420ba7405e1307bff33214",
52
    "name": "Pro Plan",
53
    "price": 20,
54
    "currency": "USD",
55
    "frequency": "monthly",
56
    "legacy_id": "pro",
57
    "is_subscribed": true,
58
    "can_subscribe": true
59
}
60
JSON;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getResultJson(): string
67
    {
68
        $owner = $this->getOwnerJson();
69
        $plan  = $this->getPlanJson();
70
71
        return <<<JSON
72
{
73
    "id": "023e105f4ecef8ad9ca31a8372d0c353",
74
    "name": "example.com",
75
    "development_mode": 7200,
76
    "original_name_servers": [
77
        "ns1.originaldnshost.com",
78
        "ns2.originaldnshost.com"
79
    ],
80
    "original_registrar": "GoDaddy",
81
    "original_dnshost": "NameCheap",
82
    "created_on": "2014-01-01T05:20:00.12345Z",
83
    "modified_on": "2014-01-01T05:20:00.12345Z",
84
    "owner": $owner,
85
    "permissions": [
86
        "#zone:read",
87
        "#zone:edit"
88
    ],
89
    "plan": $plan,
90
    "plan_pending": $plan,
91
    "status": "active",
92
    "paused": false,
93
    "type": "full",
94
    "name_servers": [
95
        "tony.ns.cloudflare.com",
96
        "woz.ns.cloudflare.com"
97
    ]
98
}
99
JSON;
100
    }
101
}
102