/**
* Returns the definition as string representation.
*
* @return string
*/
public function dump(ObjectDefinition $definition)
{
$className = $definition->getClassName();
$classExist = class_exists($className) || interface_exists($className);
// Class
if (!$classExist) {
$warning = '#UNKNOWN# ';
} else {
$class = new \ReflectionClass($className);
$warning = $class->isInstantiable() ? '' : '#NOT INSTANTIABLE# ';
}
$str = sprintf(' class = %s%s', $warning, $className);
// Scope
$str .= PHP_EOL . ' scope = ' . $definition->getScope();
// Lazy
$str .= PHP_EOL . ' lazy = ' . var_export($definition->isLazy(), true);
if ($classExist) {
// Constructor
$str .= $this->dumpConstructor($className, $definition);
// Properties
$str .= $this->dumpProperties($definition);
// Methods
$str .= $this->dumpMethods($className, $definition);
}
return sprintf('Object (' . PHP_EOL . '%s' . PHP_EOL . ')', $str);
}