lithium\console\command\Help::_properties()
Get the properties for the class.
Parameters
-
string
$class
-
array
$options
Returns
arraySource
protected function _properties($class, $options = []) {
$defaults = ['name' => null];
$options += $defaults;
$properties = Inspector::properties(new $class(['init' => false]), ['self' => false]);
$results = [];
foreach ($properties as &$property) {
if ($property['name'] === 'request' || $property['name'] === 'response') {
continue;
}
$name = str_replace('_', '-', Inflector::underscore($property['name']));
$comment = Docblock::comment($property['docComment']);
$description = trim($comment['description']);
$type = isset($comment['tags']['var']) ? strtok($comment['tags']['var'], ' ') : null;
$usage = strlen($name) == 1 ? "-{$name}" : "--{$name}";
if ($type != 'boolean') {
$usage .= "=<{$type}>";
}
$usage = "[{$usage}]";
$results[$name] = compact('name', 'description', 'type', 'usage');
if ($name == $options['name']) {
return [$name => $results[$name]];
}
}
return $results;
}