Completed
Push — master ( 4d3fdb...fd1b5e )
by Ross
02:40
created

UpdateDnsRecords::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 *
5
 * Copyright (C) 2018  Ross Mitchell
6
 *
7
 * This file is part of RossMitchell/UpdateCloudFlare.
8
 *
9
 * RossMitchell/UpdateCloudFlare is free software: you can redistribute
10
 * it and/or modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
namespace RossMitchell\UpdateCloudFlare\Responses;
24
25
use RossMitchell\UpdateCloudFlare\Abstracts\CloudFlareResponse;
26
use RossMitchell\UpdateCloudFlare\Factories\Responses\ErrorFactory;
27
use RossMitchell\UpdateCloudFlare\Factories\Responses\Results\DnsRecordFactory;
28
use RossMitchell\UpdateCloudFlare\Responses\Results\DnsRecord;
29
use Symfony\Component\Console\Exception\LogicException;
30
31
/**
32
 * Class DnsRecords
33
 * @package RossMitchell\UpdateCloudFlare\Responses
34
 */
35
class UpdateDnsRecords extends CloudFlareResponse
36
{
37
    /**
38
     * @var DnsRecord
39
     */
40
    private $result;
41
    /**
42
     * @var DnsRecordFactory
43
     */
44
    private $dnsRecordFactory;
45
46
    /**
47
     * DnsRecords constructor.
48
     *
49
     * @param DnsRecordFactory $dnsRecordFactory
50
     * @param ErrorFactory     $errorFactory
51
     * @param \stdClass        $rawResult
52
     *
53
     * @throws \RossMitchell\UpdateCloudFlare\Exceptions\CloudFlareException
54
     */
55 13
    public function __construct(DnsRecordFactory $dnsRecordFactory, ErrorFactory $errorFactory, \stdClass $rawResult)
56
    {
57 13
        $this->dnsRecordFactory = $dnsRecordFactory;
58 13
        parent::__construct($rawResult, $errorFactory);
59 8
    }
60
61
    /**
62
     * @return DnsRecord
63
     */
64 2
    public function getResult(): DnsRecord
65
    {
66 2
        return $this->result;
67
    }
68
69
    /**
70
     * @param mixed $result
71
     *
72
     * @throws LogicException
73
     */
74 8
    public function setResult($result)
75
    {
76 8
        $results = $this->dnsRecordFactory->create($result);
77
78 8
        $this->result = $results;
79 8
    }
80
}
81