@param  array{description:string,specials:array<string,array<string>>} $parsed_doc_comment
@param  string                                                         $left_padding

@return string
777877
public static function render(array $parsed_doc_comment, $left_padding)
    {
        $doc_comment_text = '/**' . "\n";

        $description_lines = null;

        $trimmed_description = trim($parsed_doc_comment['description']);

        if (!empty($trimmed_description)) {
            $description_lines = explode("\n", $parsed_doc_comment['description']);

            foreach ($description_lines as $line) {
                $doc_comment_text .= $left_padding . ' *' . (trim($line) ? ' ' . $line : '') . "\n";
            }
        }

        if ($description_lines && $parsed_doc_comment['specials']) {
            $doc_comment_text .= $left_padding . ' *' . "\n";
        }

        if ($parsed_doc_comment['specials']) {
            $last_type = null;

            foreach ($parsed_doc_comment['specials'] as $type => $lines) {
                if ($last_type !== null && $last_type !== 'psalm-return') {
                    $doc_comment_text .= $left_padding . ' *' . "\n";
                }

                foreach ($lines as $line) {
                    $doc_comment_text .= $left_padding . ' * @' . $type . ' '
                        . str_replace("\n", "\n" . $left_padding . ' *', $line) . "\n";
                }

                $last_type = $type;
            }
        }

        $doc_comment_text .= $left_padding . ' */' . "\n" . $left_padding;

        return $doc_comment_text;
    }
521706
public function pad($input, $padLength, $padString, $padType = STR_PAD_RIGHT) {
		$length = mb_strlen($input);
		if ($padLength - $length > 0) {
			switch ($padType) {
				case STR_PAD_LEFT:
					$input = str_repeat($padString, $padLength - $length) . $input;
					break;
				case STR_PAD_RIGHT:
					$input .= str_repeat($padString, $padLength - $length);
					break;
			}
		}
		return $input;
	}
685583
protected function parseQuotePairs($regexp, $leftQuote, $rightQuote)
	{
		preg_match_all($regexp, $this->text, $matches, PREG_OFFSET_CAPTURE);
		foreach ($matches[0] as $m)
		{
			$left  = $this->addTag($m[1], 1, $leftQuote);
			$right = $this->addTag($m[1] + strlen($m[0]) - 1, 1, $rightQuote);

			// Cascade left tag's invalidation to the right so that if we skip the left quote,
			// the right quote remains untouched
			$left->cascadeInvalidationTo($right);
		}
	}
555708
protected function opAdd($left, $right)
    {
        if ($strLeft = $this->coerceString($left)) {
            if ($right[0] === Type::T_STRING) {
                $right[1] = '';
            }

            $strLeft[2][] = $right;

            return $strLeft;
        }

        if ($strRight = $this->coerceString($right)) {
            if ($left[0] === Type::T_STRING) {
                $left[1] = '';
            }

            array_unshift($strRight[2], $left);

            return $strRight;
        }

        return null;
    }
1323494
function leftPad(n, prefix) {
  var s = n.toString(),
      nchars = intChars(n),
      nspaces = nchars - s.length - 1;

  prefix || (prefix = ' ');

  for (var i = 0; i < nspaces; i++) {
    prefix += ' ';
  }

  return prefix + s;
}
209010
static function snippet($text, $keywords, $limit, $max_length, $around = array('<b>', '</b>'))
	{
		$result = array();

		$keywords = self::normalize($keywords);
		list($pre, $post) = $around;
		$prev = array();
		$after = false;

		foreach(self::normalize_hash($text) as $word_orig => $word_norm)
		{
			$is_kw = false;
			if(in_array($word_norm, $keywords))
			{
				$prev[] = $pre.$word_orig.$post;
				$is_kw = true;
			}
			else
				$prev[] = $word_orig;

			if($is_kw)
			{
				if($after)
				{
					$result = array_merge($result, $prev);
					$prev = array();
				}
				else
				{
					$result = array_merge($result, count($prev) > $limit ? array('&#133') : array(), array_slice($prev, -$limit-1));
					$prev = array();
				}

				$after = true;
			}
			else
			{
				if($after && count($prev) >= $limit)
				{
					$after = false;
					$result = array_merge($result, $prev);
					$prev = array();
				}
			}
		}

		if($after)
			$result = array_merge($result, array('&#133'), $prev);

		return strip_text(join(' ', $result).'&#133;', $max_length);
	}
849156
public List<JavaComment> leftAlign(List<JavaComment> originals) {
        final List<JavaComment> results = new ArrayList<JavaComment>(
                originals.size());
        for (JavaComment original : originals) {
            results.add(original
                    .match(new JavaComment.MatchBlock<JavaComment>() {

                        @Override
                        public JavaComment _case(JavaDocComment x) {
                            final List<JDToken> leadingWhiteSpace = new ArrayList<JDToken>(1);
                            final LeftAlignState state[] = new LeftAlignState[] { LeftAlignState.IN_LINE };
                            return _JavaDocComment(x.start, leftAlignSection(x.generalSection, x.tagSections.isEmpty(), leadingWhiteSpace, state), leftAlignSections(x.tagSections, leadingWhiteSpace, state), x.end);
                        }


                        @Override
                        public JavaComment _case(JavaBlockComment x) {
                            return _JavaBlockComment(leftAlignBlock(x.lines));
                        }

                        @Override
                        public JavaComment _case(JavaEOLComment x) {
                            return x;
                        }
                    }));
        }
        return results;        
    }
667351
public function render($eol = "\n", $padding = '    ')
    {
        $method = $this->reflectionMethod;
        if ($method->isPrivate() || substr($method->getName(), 0, 2) === '__' || $method->isAbstract()) {
            return '';
        }
        $rendered = '';
        $comment = $method->getDocComment();
        if ($comment !== false) {
            $comment = trim($comment);
            if ($comment !== '') {
                $rendered .= str_replace($eol . '*', $eol . ' *', implode($eol, array_map('trim', explode("\n", $comment)))) . $eol;
            }
        }
        $visibility = \Reflection::getModifierNames($method->getModifiers());
        $isStatic = $method->isStatic();
        if ((!$isStatic) && $this->classSymbol->isFacade()) {
            $visibility[] = 'static';
        }
        $rendered .= implode(' ', array_unique($visibility)) . ' function ' . $this->handle . '(';
        $params = array();
        $calling_params = array();
        foreach ($this->parameters as $parameter) {
            $param = '';

            if ($parameter->isArray()) {
                $param .= 'array ';
            } /*else if ($parameter->isCallable()) { // This should be enabled for php 5.4
                $param .= 'callable ';
            } */ else {
     try {
         if (is_object($parameter->getClass())) {
             $param .= $parameter->getClass()->getName() . ' ';
         }
     } catch (\ReflectionException $e) {
         $class = $this->reflectionMethod->getDeclaringClass()->getName();
         echo "Invalid type hint in {$class}::{$this->handle}\n";
     }
 }
            if ($parameter->isPassedByReference()) {
                $param .= "&";
            }
            $param .= '$' . $parameter->getName();

            if ($parameter->isOptional()) {
                $defaultValue = null;
                if (method_exists($parameter, 'getDefaultValueConstantName')) {
                    $defaultValue = $parameter->getDefaultValueConstantName();
                }
                if ($defaultValue) {
                    // Strip out wrong namespaces.
                    if (preg_match('/.\\\\(\\w+)$/', $defaultValue, $matches) && defined($matches[1])) {
                        $defaultValue = $matches[1];
                    }
                } else {
                    $v = $parameter->getDefaultValue();
                    switch (gettype($v)) {
                        case 'boolean':
                        case 'integer':
                        case 'double':
                        case 'NULL':
                            $defaultValue = json_encode($v);
                            break;
                        case 'string':
                            $defaultValue = '"' . addslashes($v) . '"';
                            break;
                        case 'array':
                            if (count($v)) {
                                $defaultValue = trim(var_export($v, true));
                            } else {
                                $defaultValue = 'array()';
                            }
                            break;
                        case 'object':
                        case 'resource':
                        default:
                            $defaultValue = trim(var_export($v, true));
                            break;
                    }
                }
                $param .= ' = ' . $defaultValue;
            }

            $params[] = $param;
            $calling_params[] = '$' . $parameter->getName();
        }
        $rendered .= implode(', ', $params) . "){$eol}{{$eol}";
        $class_name = $method->getDeclaringClass()->getName();
        $rendered .= $padding . 'return ';
        if ($isStatic) {
            $rendered .= $class_name . '::' . $method->getName();
        } elseif ($this->classSymbol->isFacade()) {
            $rendered .= 'static::$instance->' . $method->getName();
        } else {
            $rendered .= 'parent::' . $method->getName();
        }
        $rendered .= '(' . implode(', ', $calling_params) . ');' . $eol;
        $rendered .= '}' . $eol;

        return $rendered;
    }
204460
def split_comments(comments):
    """"""
    flags = []
    other = []
    for c in comments:
        if len(c) > 1 and c[1] == ',':
            flags.append(c)
        else:
            other.append(c)
    return flags, other
1229908
func leftPad(input []byte, size int) (out []byte) {
	n := len(input)
	if n > size {
		n = size
	}
	out = make([]byte, size)
	copy(out[len(out)-n:], input)
	return
}
272635
protected function padArray($arr, $final_length, $padding_side = 'right')
    {
        foreach ($arr as $key => $value) {
            $arr[$key] = $this->pad($value, $final_length, $padding_side);
        }

        return $arr;
    }
426246
static public function fromString($string, $paddingDirection = self::PAD_LEFT)
    {
        if (!class_exists("Normalizer")) {
            // Data representation Normalization not supported
            return new Buffer($string, null, $paddingDirection);
        }

        // Normalizer is used to avoid problems with UTF-8 serialization
        $normalized = \Normalizer::normalize($string, \Normalizer::FORM_KD);
        return new Buffer($normalized, null, $paddingDirection);
    }
424490
def get_left_right(seq):
    
    cseq = seq.strip(GAPS)
    leftjust = seq.index(cseq[0])
    rightjust = seq.rindex(cseq[-1])

    return leftjust, rightjust
438872
function leftPad(n, prefix, maxN) {
  const s = n.toString();
  const nchars = Math.max(2, String(maxN).length) + 1;
  const nspaces = nchars - s.length - 1;

  return prefix + ' '.repeat(nspaces) + s;
}
496622
public static function left(string $string, int $count): string
    {
        return self::substr($string, 0, $count);
    }
305725
public function comment($spaceId, $threadId, $comment, array $mentions = [], array $files = [], $guestSpaceId = null): array
    {
        $options = ['json' => [
            'space'  => $spaceId,
            'thread' => $threadId,
            'comment'  => [
                'text' => $comment,
                'mentions' => $mentions,
                'files' => $files
            ],
        ]];

        /** @var JsonStream $stream */
        $stream = $this->client
            ->post(KintoneApi::generateUrl('space/thread/comment.json', $guestSpaceId), $options)
            ->getBody();

        return $stream->jsonSerialize();
    }
313967
public static function explodeWithPadding($glue, $data, $length = null, $padding=null)
	{
	    $array = static::explode($glue, $data, $length);
	    
	    if (count($array) < $length)
	    {
	        foreach (range(1, $length - count($array)) as $i)
	        {
	            array_push($array, $padding);
	        }
	    }
	    
	    return $array;
	}