Conditions | 4 |
Paths | 5 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
41 | 60 | public function __construct() |
|
42 | { |
||
43 | 60 | foreach ($this->labels as $label) { |
|
44 | 59 | if (!preg_match('/^(?![_]{2})[a-zA-Z_][a-zA-Z0-9_]*$/', $label)) { |
|
45 | 59 | throw new LabelException("The label `{$label}` contains invalid characters."); |
|
46 | } |
||
47 | } |
||
48 | |||
49 | 59 | if (!preg_match('/^[a-zA-Z_:][a-zA-Z0-9_:]*$/', $this->key())) { |
|
50 | 1 | throw new PrometheusException("The metric name `{$this->key()}` contains invalid characters."); |
|
51 | } |
||
115 |