| Conditions | 7 |
| Paths | 7 |
| Total Lines | 28 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 89 | public function setOptions(? Iterable $config = null) : AdapterInterface |
||
| 90 | { |
||
| 91 | if ($config === null) { |
||
| 92 | return $this; |
||
| 93 | } |
||
| 94 | |||
| 95 | foreach ($config as $option => $value) { |
||
| 96 | switch ($option) { |
||
| 97 | case 'date_format': |
||
| 98 | case 'format': |
||
| 99 | $this->{$option} = (string)$value; |
||
| 100 | break; |
||
| 101 | |||
| 102 | case 'level': |
||
| 103 | if (!is_numeric($value)) { |
||
| 104 | throw new Exception('log level must be a number'); |
||
| 105 | } |
||
| 106 | |||
| 107 | $this->level = (int)$value; |
||
| 108 | break; |
||
| 109 | |||
| 110 | default: |
||
| 111 | throw new Exception('invalid option '.$option.' given'); |
||
| 112 | } |
||
| 113 | } |
||
| 114 | |||
| 115 | return $this; |
||
| 116 | } |
||
| 117 | } |
||
| 118 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.