mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-11-30 04:19:30 +01:00
17 lines
345 B
PHP
17 lines
345 B
PHP
|
<?php
|
||
|
|
||
|
namespace PhpParser;
|
||
|
|
||
|
require __DIR__ . '/../lib/bootstrap.php';
|
||
|
|
||
|
function canonicalize($str) {
|
||
|
// trim from both sides
|
||
|
$str = trim($str);
|
||
|
|
||
|
// normalize EOL to \n
|
||
|
$str = str_replace(array("\r\n", "\r"), "\n", $str);
|
||
|
|
||
|
// trim right side of all lines
|
||
|
return implode("\n", array_map('rtrim', explode("\n", $str)));
|
||
|
}
|