Remove brackets for invalid mail addresses when updating the license header

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2017-10-24 11:57:33 +02:00
parent 44f9779f9f
commit 7006b739b0
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 9 additions and 0 deletions

View File

@ -322,6 +322,7 @@ With help from many libraries and frameworks including:
}
$authors = array_map(function($author){
$author = $this->fixInvalidEmail($author);
$this->authors[$author] = $author;
return " * @author $author";
}, $authors);
@ -348,6 +349,14 @@ With help from many libraries and frameworks including:
}
return $author;
}
private function fixInvalidEmail($author) {
preg_match('/<(.*)>/', $author, $mailMatch);
if (count($mailMatch) === 2 && !filter_var($mailMatch[1], FILTER_VALIDATE_EMAIL)) {
$author = str_replace('<'.$mailMatch[1].'>', '"'.$mailMatch[1].'"', $author);
}
return $author;
}
}
$licenses = new Licenses;