if (!empty($docblock->tags)) {
foreach ($docblock::$vectors as $name => $vector) {
if (isset($docblock->tags[$name])) {
- $chunks[] = sprintf('<comment>%s:</comment>', self::inflect($name));
+ $chunks[] = \sprintf('<comment>%s:</comment>', self::inflect($name));
$chunks[] = self::formatVector($vector, $docblock->tags[$name]);
$chunks[] = '';
}
}
- $tags = self::formatTags(array_keys($docblock::$vectors), $docblock->tags);
+ $tags = self::formatTags(\array_keys($docblock::$vectors), $docblock->tags);
if (!empty($tags)) {
$chunks[] = $tags;
$chunks[] = '';
}
}
- return rtrim(implode("\n", $chunks));
+ return \rtrim(\implode("\n", $chunks));
}
/**
$max = 0;
foreach ($lines as $line) {
$chunk = $line[$type];
- $cur = empty($chunk) ? 0 : strlen($chunk) + 1;
+ $cur = empty($chunk) ? 0 : \strlen($chunk) + 1;
if ($cur > $max) {
$max = $cur;
}
$template[] = self::getVectorParamTemplate($type, $max);
}
- $template = implode(' ', $template);
+ $template = \implode(' ', $template);
- return implode("\n", array_map(function ($line) use ($template) {
- $escaped = array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $line);
+ return \implode("\n", \array_map(function ($line) use ($template) {
+ $escaped = \array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $line);
- return rtrim(vsprintf($template, $escaped));
+ return \rtrim(\vsprintf($template, $escaped));
}, $lines));
}
$chunks = [];
foreach ($tags as $name => $values) {
- if (in_array($name, $skip)) {
+ if (\in_array($name, $skip)) {
continue;
}
foreach ($values as $value) {
- $chunks[] = sprintf('<comment>%s%s</comment> %s', self::inflect($name), empty($value) ? '' : ':', OutputFormatter::escape($value));
+ $chunks[] = \sprintf('<comment>%s%s</comment> %s', self::inflect($name), empty($value) ? '' : ':', OutputFormatter::escape($value));
}
$chunks[] = '';
}
- return implode("\n", $chunks);
+ return \implode("\n", $chunks);
}
/**
private static function getVectorParamTemplate($type, $max)
{
if (!isset(self::$vectorParamTemplates[$type])) {
- return sprintf('%%-%ds', $max);
+ return \sprintf('%%-%ds', $max);
}
- return sprintf('<%s>%%-%ds</%s>', self::$vectorParamTemplates[$type], $max, self::$vectorParamTemplates[$type]);
+ return \sprintf('<%s>%%-%ds</%s>', self::$vectorParamTemplates[$type], $max, self::$vectorParamTemplates[$type]);
}
/**
*/
private static function indent($text, $indent = ' ')
{
- return $indent . str_replace("\n", "\n" . $indent, $text);
+ return $indent . \str_replace("\n", "\n" . $indent, $text);
}
/**
*/
private static function inflect($text)
{
- $words = trim(preg_replace('/[\s_-]+/', ' ', preg_replace('/([a-z])([A-Z])/', '$1 $2', $text)));
+ $words = \trim(\preg_replace('/[\s_-]+/', ' ', \preg_replace('/([a-z])([A-Z])/', '$1 $2', $text)));
- return implode(' ', array_map('ucfirst', explode(' ', $words)));
+ return \implode(' ', \array_map('ucfirst', \explode(' ', $words)));
}
}