X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FFormatter%2FDocblockFormatter.php;fp=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FFormatter%2FDocblockFormatter.php;h=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=c1e8af9c1a8fc1d34e0509640eba4fc4f9261555;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website
diff --git a/vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php b/vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php
deleted file mode 100644
index c1e8af9c1..000000000
--- a/vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php
+++ /dev/null
@@ -1,168 +0,0 @@
- 'info',
- 'var' => 'strong',
- );
-
- /**
- * Format a docblock.
- *
- * @param \Reflector $reflector
- *
- * @return string Formatted docblock
- */
- public static function format(\Reflector $reflector)
- {
- $docblock = new Docblock($reflector);
- $chunks = array();
-
- if (!empty($docblock->desc)) {
- $chunks[] = 'Description:';
- $chunks[] = self::indent(OutputFormatter::escape($docblock->desc), ' ');
- $chunks[] = '';
- }
-
- if (!empty($docblock->tags)) {
- foreach ($docblock::$vectors as $name => $vector) {
- if (isset($docblock->tags[$name])) {
- $chunks[] = sprintf('%s:', self::inflect($name));
- $chunks[] = self::formatVector($vector, $docblock->tags[$name]);
- $chunks[] = '';
- }
- }
-
- $tags = self::formatTags(array_keys($docblock::$vectors), $docblock->tags);
- if (!empty($tags)) {
- $chunks[] = $tags;
- $chunks[] = '';
- }
- }
-
- return rtrim(implode("\n", $chunks));
- }
-
- /**
- * Format a docblock vector, for example, `@throws`, `@param`, or `@return`.
- *
- * @see DocBlock::$vectors
- *
- * @param array $vector
- * @param array $lines
- *
- * @return string
- */
- private static function formatVector(array $vector, array $lines)
- {
- $template = array(' ');
- foreach ($vector as $type) {
- $max = 0;
- foreach ($lines as $line) {
- $chunk = $line[$type];
- $cur = empty($chunk) ? 0 : strlen($chunk) + 1;
- if ($cur > $max) {
- $max = $cur;
- }
- }
-
- $template[] = self::getVectorParamTemplate($type, $max);
- }
- $template = implode(' ', $template);
-
- return implode("\n", array_map(function ($line) use ($template) {
- $escaped = array_map(array('Symfony\Component\Console\Formatter\OutputFormatter', 'escape'), $line);
-
- return rtrim(vsprintf($template, $escaped));
- }, $lines));
- }
-
- /**
- * Format docblock tags.
- *
- * @param array $skip Tags to exclude
- * @param array $tags Tags to format
- *
- * @return string formatted tags
- */
- private static function formatTags(array $skip, array $tags)
- {
- $chunks = array();
-
- foreach ($tags as $name => $values) {
- if (in_array($name, $skip)) {
- continue;
- }
-
- foreach ($values as $value) {
- $chunks[] = sprintf('%s%s %s', self::inflect($name), empty($value) ? '' : ':', OutputFormatter::escape($value));
- }
-
- $chunks[] = '';
- }
-
- return implode("\n", $chunks);
- }
-
- /**
- * Get a docblock vector template.
- *
- * @param string $type Vector type
- * @param int $max Pad width
- *
- * @return string
- */
- private static function getVectorParamTemplate($type, $max)
- {
- if (!isset(self::$vectorParamTemplates[$type])) {
- return sprintf('%%-%ds', $max);
- }
-
- return sprintf('<%s>%%-%ds%s>', self::$vectorParamTemplates[$type], $max, self::$vectorParamTemplates[$type]);
- }
-
- /**
- * Indent a string.
- *
- * @param string $text String to indent
- * @param string $indent (default: ' ')
- *
- * @return string
- */
- private static function indent($text, $indent = ' ')
- {
- return $indent . str_replace("\n", "\n" . $indent, $text);
- }
-
- /**
- * Convert underscored or whitespace separated words into sentence case.
- *
- * @param string $text
- *
- * @return string
- */
- private static function inflect($text)
- {
- $words = trim(preg_replace('/[\s_-]+/', ' ', preg_replace('/([a-z])([A-Z])/', '$1 $2', $text)));
-
- return implode(' ', array_map('ucfirst', explode(' ', $words)));
- }
-}