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

UpdateDnsRecordFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
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\Requests;
23
24
use RossMitchell\UpdateCloudFlare\Data\SubDomainInfo;
25
use RossMitchell\UpdateCloudFlare\Interfaces\ConfigInterface;
26
use RossMitchell\UpdateCloudFlare\Interfaces\HeadersInterface;
27
use RossMitchell\UpdateCloudFlare\Requests\UpdateDnsRecords;
28
29
class UpdateDnsRecordFactory
30
{
31
    /**
32
     * @var ConfigInterface
33
     */
34
    private $config;
35
    /**
36
     * @var HeadersInterface
37
     */
38
    private $headers;
39
40
    /**
41
     * UpdateDnsRecordFactory constructor.
42
     *
43
     * @param ConfigInterface  $config
44
     * @param HeadersInterface $headers
45
     */
46 5
    public function __construct(
47
        ConfigInterface $config,
48
        HeadersInterface $headers
49
    ) {
50
51 5
        $this->config  = $config;
52 5
        $this->headers = $headers;
53 5
    }
54
55
    /**
56
     * @param SubDomainInfo $subDomainInfo
57
     *
58
     * @return UpdateDnsRecords
59
     */
60 5
    public function create(SubDomainInfo $subDomainInfo): UpdateDnsRecords
61
    {
62 5
        $request = new UpdateDnsRecords($this->config, $this->headers);
63 5
        $request->setSubDomainInfo($subDomainInfo);
64
65 5
        return $request;
66
    }
67
}
68