From 1f78547ca29d387d89df7aefdb87334e3557bd6f Mon Sep 17 00:00:00 2001 From: belliash Date: Tue, 21 May 2019 21:34:14 +0200 Subject: [PATCH] Convert DOS2UNIX. --- tests/path_split.aer | 64 ++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/path_split.aer b/tests/path_split.aer index 4c16d43..516ce66 100644 --- a/tests/path_split.aer +++ b/tests/path_split.aer @@ -1,32 +1,32 @@ -class Program { - - string[] parsePathComponents(string $path, bool $endSlash=true, bool $base=false) { - string[] $retArray; - $path = trim($path); - string $str, $temp; - char $char; - for(int $x = 0; $char = $path[$x]; $x++) { - if(!strstr('/', $char)) $temp += $char; - else if($temp) { - $str += $temp; - $retArray[$temp] = $str + ($endSlash ? '/' : ''); - $str += '/'; - $temp = ''; - } - } - ($base && $temp) ? $retArray[$temp] = $str + $temp : NULL; - return $retArray; - } - - public void main() { - string $path = '/my//stupid//path/to///some/file.php'; - print_r($this->parsePathComponents($path)); - - $path = 'my/other//path/'; - print_r($this->parsePathComponents($path, false)); - - $path = '/my//other/path/to///file.php'; - print_r($this->parsePathComponents($path, true, true)); - } - -} +class Program { + + string[] parsePathComponents(string $path, bool $endSlash=true, bool $base=false) { + string[] $retArray; + $path = trim($path); + string $str, $temp; + char $char; + for(int $x = 0; $char = $path[$x]; $x++) { + if(!strstr('/', $char)) $temp += $char; + else if($temp) { + $str += $temp; + $retArray[$temp] = $str + ($endSlash ? '/' : ''); + $str += '/'; + $temp = ''; + } + } + ($base && $temp) ? $retArray[$temp] = $str + $temp : NULL; + return $retArray; + } + + public void main() { + string $path = '/my//stupid//path/to///some/file.php'; + print_r($this->parsePathComponents($path)); + + $path = 'my/other//path/'; + print_r($this->parsePathComponents($path, false)); + + $path = '/my//other/path/to///file.php'; + print_r($this->parsePathComponents($path, true, true)); + } + +}