Conditions | 4 |
Paths | 6 |
Total Lines | 25 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function __construct(AppConfig $config, ILogger $logger) { |
||
31 | parent::__construct($config, $logger); |
||
32 | |||
33 | $this->avHost = $this->appConfig->getAvHost(); |
||
34 | $this->avPort = $this->appConfig->getAvPort(); |
||
35 | $checks = [ |
||
36 | 'hostname' => $this->avHost, |
||
37 | 'port' => $this->avPort |
||
38 | ]; |
||
39 | $errors = []; |
||
40 | foreach ($checks as $key => $check) { |
||
41 | if ($check === '') { |
||
42 | $errors[] = sprintf( |
||
43 | 'Daemon mode requires a %s but it is empty.', |
||
44 | $key |
||
45 | ); |
||
46 | } |
||
47 | } |
||
48 | |||
49 | if (count($errors) > 0) { |
||
50 | throw new InitException( |
||
51 | 'The app is not configured properly. ' . implode(' ', $errors) |
||
52 | ); |
||
53 | } |
||
54 | } |
||
55 | |||
73 |
If you suppress an error, we recommend checking for the error condition explicitly: