private function generateProperties($definition)
{
$staticProperties = $definition->customStaticProperties();
$properties = $definition->customProperties();
$source = '';
foreach ($staticProperties as $name => $value) {
$source .= "\n public static \$" . $name . ' = ' . (null === $value ? 'null' : var_export($value, true)) . ';';
}
foreach ($properties as $name => $value) {
$source .= "\n public \$" . $name . ' = ' . (null === $value ? 'null' : var_export($value, true)) . ';';
}
$methods = $definition->methods()->allMethods();
$uncallableMethodNames = array();
$traitMethodNames = array();
foreach ($methods as $methodName => $method) {
$methodName = strtolower($methodName);
if (!$method->isCallable()) {
$uncallableMethodNames[$methodName] = true;
} elseif ($method instanceof TraitMethodDefinition) {
$traitMethodNames[$methodName] = $method->method()->getDeclaringClass()->getName();
}
}
$source .= "\n private static \$_uncallableMethods = ";
if (empty($uncallableMethodNames)) {
$source .= 'array()';
} else {
$source .= var_export($uncallableMethodNames, true);
}
$source .= ";\n private static \$_traitMethods = ";
if (empty($traitMethodNames)) {
$source .= 'array()';
} else {
$source .= var_export($traitMethodNames, true);
}
$source .= ";\n" . " private static \$_customMethods = array();\n" . " private static \$_staticHandle;\n" . ' private $_handle;';
return $source;
}