diff options
author | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-08-21 11:44:58 +0200 |
---|---|---|
committer | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-08-21 11:44:58 +0200 |
commit | bed337bd3b89c120c4ab1363b5b3d1dfd19226db (patch) | |
tree | 2c8a84b6545e6efa97d7d9005e008c19508d028e /Praspel.php | |
parent | 073c2f3644f9100ff367ac06da7b0c8b84fea964 (diff) | |
download | Praspel-bed337bd3b89c120c4ab1363b5b3d1dfd19226db.zip Praspel-bed337bd3b89c120c4ab1363b5b3d1dfd19226db.tar.gz Praspel-bed337bd3b89c120c4ab1363b5b3d1dfd19226db.tar.bz2 |
Relax the extractFromComment() method.
Returns an empty string instead of throwing exceptions.
Diffstat (limited to 'Praspel.php')
-rw-r--r-- | Praspel.php | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Praspel.php b/Praspel.php index 50f58a2..e6e0f3b 100644 --- a/Praspel.php +++ b/Praspel.php @@ -673,23 +673,18 @@ class Praspel { * @access public * @param string $comment Comment. * @return string - * @throw \Hoa\Praspel\Exception */ public static function extractFromComment ( $comment ) { $i = preg_match('#/\*(.*?)\*/#s', $comment, $matches); if(0 === $i) - throw new Exception\Generic( - 'Not able to extract Praspel from the following ' . - 'comment:' . "\n" . '%s', 8, $comment); + return ''; $i = preg_match_all('#^[\s\*]*\s*\*\s?([^\n]*)$#m', $matches[1], $maatches); if(0 === $i) - throw new Exception\Generic( - 'Not able to extract Praspel from the following ' . - 'comment:' . "\n" . '%s', 9, $comment); + return ''; return trim(implode("\n", $maatches[1])); } |