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