菜谱项目

bootstrap.php 446B

123456789101112131415161718192021
  1. <?php
  2. namespace PhpParser;
  3. require __DIR__ . '/../vendor/autoload.php';
  4. function canonicalize($str) {
  5. // normalize EOL style
  6. $str = str_replace("\r\n", "\n", $str);
  7. // trim newlines at end
  8. $str = rtrim($str, "\n");
  9. // remove trailing whitespace on all lines
  10. $lines = explode("\n", $str);
  11. $lines = array_map(function($line) {
  12. return rtrim($line, " \t");
  13. }, $lines);
  14. return implode("\n", $lines);
  15. }