Пример #1
0
 /**
  * Calculate the trailing whitespace indentation.
  *
  * What we're doing here is grabbing everything after the final newline.
  *
  * @param Token $token
  *
  * @return string
  */
 public static function calculateTrailingWhitespaceIndent(Token $token)
 {
     if (!$token->isWhitespace()) {
         throw new \InvalidArgumentException(sprintf('The given token must be whitespace, got "%s".', $token->getName()));
     }
     return ltrim(strrchr(str_replace(array("\r\n", "\r"), "\n", $token->getContent()), 10), "\n");
 }