Conditions | 7 |
Paths | 7 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
81 | public function setOptions(? Iterable $config = null): AdapterInterface |
||
82 | { |
||
83 | if (null === $config) { |
||
84 | return $this; |
||
85 | } |
||
86 | |||
87 | foreach ($config as $option => $value) { |
||
88 | switch ($option) { |
||
89 | case 'date_format': |
||
90 | case 'format': |
||
91 | $this->{$option} = (string) $value; |
||
92 | |||
93 | break; |
||
94 | case 'level': |
||
95 | if (!is_numeric($value)) { |
||
96 | throw new Exception('log level must be a number'); |
||
97 | } |
||
98 | |||
99 | $this->level = (int) $value; |
||
100 | |||
101 | break; |
||
102 | default: |
||
103 | throw new Exception('invalid option '.$option.' given'); |
||
104 | } |
||
105 | } |
||
106 | |||
107 | return $this; |
||
108 | } |
||
110 |