private static function PHPUnit_Util_Test::parseAnnotations in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Util/Test.php \PHPUnit_Util_Test::parseAnnotations()
@since Method available since Release 3.4.0
Parameters
string $docblock:
Return value
array
1 call to PHPUnit_Util_Test::parseAnnotations()
- PHPUnit_Util_Test::parseTestMethodAnnotations in vendor/
phpunit/ phpunit/ src/ Util/ Test.php - @since Method available since Release 3.4.0
File
- vendor/
phpunit/ phpunit/ src/ Util/ Test.php, line 509
Class
- PHPUnit_Util_Test
- Test helpers.
Code
private static function parseAnnotations($docblock) {
$annotations = array();
// Strip away the docblock header and footer to ease parsing of one line annotations
$docblock = substr($docblock, 3, -2);
if (preg_match_all('/@(?P<name>[A-Za-z_-]+)(?:[ \\t]+(?P<value>.*?))?[ \\t]*\\r?$/m', $docblock, $matches)) {
$numMatches = count($matches[0]);
for ($i = 0; $i < $numMatches; ++$i) {
$annotations[$matches['name'][$i]][] = $matches['value'][$i];
}
}
return $annotations;
}