ContainerUtil.php in Crumbs, the Breadcrumbs suite 7.2
File
lib/Container/ContainerUtil.php
View source
<?php
class crumbs_Container_ContainerUtil {
static function getAllProperties($container) {
$reflClass = new ReflectionClass($container);
$data = array();
foreach (self::extractProperties($reflClass
->getDocComment()) as $propertyName) {
$data[$propertyName] = $container->{$propertyName};
}
return $data;
}
private static function extractProperties($classDocComment) {
$identifier = '[a-zA-Z_][a-zA-Z0-9_]*';
$namespaceFragment = '\\\\' . $identifier;
$type = "{$identifier}({$namespaceFragment})*";
$type = "({$type}|\\\\{$type})";
$propertyNames = array();
foreach (explode("\n", $classDocComment) as $docLine) {
if (preg_match("#@property +{$type} +(\\\$|)({$identifier}) *\$#", $docLine, $m)) {
$propertyNames[] = $m[5];
}
}
return $propertyNames;
}
}