Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | 14 | public function __construct($author) |
|
27 | { |
||
28 | 14 | if (preg_match('/^(?P<name>[- \.,\p{L}\'’]+) <(?P<email>.+?)>$/u', $author, $match)) { |
|
29 | 11 | $this->setName($match['name']); |
|
30 | 11 | $this->setEmail($match['email']); |
|
31 | 10 | }else{ |
|
32 | 4 | throw new \InvalidArgumentException(sprintf( |
|
33 | 4 | 'Invalid author "%s". Must be in the format: "name <[email protected]>"', |
|
34 | $author |
||
35 | 4 | )); |
|
36 | } |
||
37 | 10 | } |
|
38 | |||
101 |