Conditions | 4 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
34 | public function __toString(): string |
||
35 | { |
||
36 | $hash = $this->hash; |
||
37 | |||
38 | if (empty($hash) || !\preg_match('/^[0-9a-f]{40}$/', $hash)) { |
||
39 | throw new \InvalidArgumentException(\sprintf('Invalid commit hash%s', empty($hash) ? '. Empty hash provided' : " \"$hash\"")); |
||
40 | } |
||
41 | |||
42 | return $hash; |
||
43 | } |
||
50 |