InvalidConfigStateException   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 12
dl 0
loc 27
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 1 1
A getValidationMessages() 0 2 1
A __construct() 0 3 1
A getMessagesAsYmlString() 0 10 2
1
<?php
2
3
namespace Logikos\Util\Config;
4
5
class InvalidConfigStateException extends ConfigException {
6
7
  /** @var StrictConfig */
8
  private $config;
9
10 4
  public function __construct(StrictConfig $config) {
11 4
    $this->config = $config;
12 4
    parent::__construct($this->getMessagesAsYmlString());
13 4
  }
14
15 4
  public function getMessagesAsYmlString() {
16 4
    $string = '';
17 4
    foreach ($this->config->validationMessages() as $fieldName => $messages) {
18 3
      $string .= sprintf(
19 3
          "\n%s:\n- %s",
20 3
          $fieldName,
21 3
          implode("\n- ", $messages)
22
      );
23
    }
24 4
    return trim($string);
25
  }
26
27 1
  public function getValidationMessages() {
28 1
    return $this->config->validationMessages();
29
  }
30
31
  public function getConfig() { return $this->config; }
32
}