Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
16 | 6 | public function __construct(string $gtid) |
|
17 | { |
||
18 | 6 | if (false === (bool)preg_match('/^([0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})((?::[0-9-]+)+)$/', $gtid, $matches)) { |
|
19 | 1 | throw new GtidException(GtidException::INCORRECT_GTID_MESSAGE, GtidException::INCORRECT_GTID_CODE); |
|
20 | } |
||
21 | |||
22 | 5 | $this->sid = $matches[1]; |
|
23 | 5 | foreach (array_filter(explode(':', $matches[2])) as $k) { |
|
24 | 5 | $this->intervals[] = explode('-', $k); |
|
25 | } |
||
26 | 5 | $this->sid = str_replace('-', '', $this->sid); |
|
27 | 5 | } |
|
51 | } |