Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/test/bootstrap.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 5fb285c0d0e3 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace PhpParser; | |
4 | |
5 require __DIR__ . '/../vendor/autoload.php'; | |
6 | |
7 function canonicalize($str) { | |
8 // normalize EOL style | |
9 $str = str_replace("\r\n", "\n", $str); | |
10 | |
11 // trim newlines at end | |
12 $str = rtrim($str, "\n"); | |
13 | |
14 // remove trailing whitespace on all lines | |
15 $lines = explode("\n", $str); | |
16 $lines = array_map(function($line) { | |
17 return rtrim($line, " \t"); | |
18 }, $lines); | |
19 return implode("\n", $lines); | |
20 } |