DnsRecordsFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 33
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 3 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\Factories\Responses;
23
24
use RossMitchell\UpdateCloudFlare\Exceptions\CloudFlareException;
25
use RossMitchell\UpdateCloudFlare\Factories\Responses\Results\DnsRecordFactory;
26
use RossMitchell\UpdateCloudFlare\Responses\DnsRecords;
27
use Symfony\Component\Console\Exception\LogicException;
28
29
/**
30
 * Class DnsRecordsFactory
31
 * @package RossMitchell\UpdateCloudFlare\Factories\Responses
32
 */
33
class DnsRecordsFactory
34
{
35
    /**
36
     * @var DnsRecordFactory
37
     */
38
    private $dnsRecordFactory;
39
    /**
40
     * @var ErrorFactory
41
     */
42
    private $errorFactory;
43
44
    /**
45
     * ListZoneFactory constructor.
46
     *
47
     * @param DnsRecordFactory $dnsRecordFactory
48
     * @param ErrorFactory     $errorFactory
49
     */
50 17
    public function __construct(DnsRecordFactory $dnsRecordFactory, ErrorFactory $errorFactory)
51
    {
52 17
        $this->dnsRecordFactory = $dnsRecordFactory;
53 17
        $this->errorFactory     = $errorFactory;
54 17
    }
55
56
    /**
57
     * @param \stdClass $data
58
     *
59
     * @return DnsRecords
60
     * @throws LogicException
61
     * @throws CloudFlareException
62
     */
63 15
    public function create(\stdClass $data): DnsRecords
64
    {
65 15
        return new DnsRecords($this->dnsRecordFactory, $this->errorFactory, $data);
66
    }
67
}
68