|
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\Command; |
|
24
|
|
|
|
|
25
|
|
|
use RossMitchell\UpdateCloudFlare\Abstracts\Command; |
|
26
|
|
|
use RossMitchell\UpdateCloudFlare\Exceptions\CloudFlareException; |
|
27
|
|
|
use RossMitchell\UpdateCloudFlare\Interfaces\ConfigInterface; |
|
28
|
|
|
use RossMitchell\UpdateCloudFlare\Model\UpdateSubDomain; |
|
|
|
|
|
|
29
|
|
|
use Symfony\Component\Console\Exception\InvalidArgumentException; |
|
30
|
|
|
use Symfony\Component\Console\Exception\LogicException; |
|
31
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
32
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Class UpdateSubDomains |
|
36
|
|
|
* @package RossMitchell\UpdateCloudFlare\Command |
|
37
|
|
|
*/ |
|
38
|
|
|
class UpdateSubDomains extends Command |
|
39
|
|
|
{ |
|
40
|
|
|
/** |
|
41
|
|
|
* @var UpdateSubDomain |
|
42
|
|
|
*/ |
|
43
|
|
|
private $subDomain; |
|
44
|
|
|
/** |
|
45
|
|
|
* @var ConfigInterface |
|
46
|
|
|
*/ |
|
47
|
|
|
private $config; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* UpdateSubDomains constructor. |
|
51
|
|
|
* |
|
52
|
|
|
* @param UpdateSubDomain $subDomain |
|
53
|
|
|
* @param ConfigInterface $config |
|
54
|
|
|
* @param string|null $name |
|
55
|
|
|
* |
|
56
|
|
|
* @throws LogicException |
|
57
|
|
|
*/ |
|
58
|
|
|
public function __construct(UpdateSubDomain $subDomain, ConfigInterface $config, string $name = null) |
|
59
|
|
|
{ |
|
60
|
|
|
parent::__construct($name); |
|
61
|
|
|
$this->subDomain = $subDomain; |
|
62
|
|
|
$this->config = $config; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @param InputInterface $input |
|
67
|
|
|
* @param OutputInterface $output |
|
68
|
|
|
* |
|
69
|
|
|
* @throws LogicException |
|
70
|
|
|
* @throws \RuntimeException |
|
71
|
|
|
* @throws InvalidArgumentException |
|
72
|
|
|
* @throws CloudFlareException |
|
73
|
|
|
*/ |
|
74
|
|
|
public function runCommand(InputInterface $input, OutputInterface $output) |
|
75
|
|
|
{ |
|
76
|
|
|
$newIpAddress = $input->getOption('ip-address'); |
|
77
|
|
|
if (!empty($newIpAddress)) { |
|
78
|
|
|
$this->subDomain->setIpAddress($newIpAddress); |
|
79
|
|
|
} |
|
80
|
|
|
$subDomains = $this->config->getSubDomains(); |
|
81
|
|
|
foreach ($subDomains as $subDomain) { |
|
82
|
|
|
$this->subDomain->setSubDomain($subDomain); |
|
83
|
|
|
$message = $this->subDomain->updateSubDomain(); |
|
84
|
|
|
$output->writeln($message); |
|
85
|
|
|
} |
|
86
|
|
|
$output->writeln('All sub domains have been updated'); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths