Commit 92c64994 by Alexander Makarov

Improved strtr calls

parent 81d5dd01
...@@ -61,7 +61,7 @@ class CodeFile extends Object ...@@ -61,7 +61,7 @@ class CodeFile extends Object
*/ */
public function __construct($path, $content) public function __construct($path, $content)
{ {
$this->path = strtr($path, ['/' => DIRECTORY_SEPARATOR, '\\' => DIRECTORY_SEPARATOR]); $this->path = strtr($path, '/\\', DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR);
$this->content = $content; $this->content = $content;
$this->id = md5($this->path); $this->id = md5($this->path);
if (is_file($path)) { if (is_file($path)) {
......
...@@ -42,7 +42,7 @@ class BaseFileHelper ...@@ -42,7 +42,7 @@ class BaseFileHelper
*/ */
public static function normalizePath($path, $ds = DIRECTORY_SEPARATOR) public static function normalizePath($path, $ds = DIRECTORY_SEPARATOR)
{ {
$path = rtrim(strtr($path, ['/' => $ds, '\\' => $ds]), $ds); $path = rtrim(strtr($path, '/\\', $ds . $ds), $ds);
if (strpos($ds . $path, "{$ds}.") === false && strpos($path, "{$ds}{$ds}") === false) { if (strpos($ds . $path, "{$ds}.") === false && strpos($path, "{$ds}{$ds}") === false) {
return $path; return $path;
} }
......
...@@ -114,7 +114,7 @@ class BaseVarDumper ...@@ -114,7 +114,7 @@ class BaseVarDumper
$spaces = str_repeat(' ', $level * 4); $spaces = str_repeat(' ', $level * 4);
self::$_output .= "$className#$id\n" . $spaces . '('; self::$_output .= "$className#$id\n" . $spaces . '(';
foreach ((array) $var as $key => $value) { foreach ((array) $var as $key => $value) {
$keyDisplay = strtr(trim($key), ["\0" => ':']); $keyDisplay = strtr(trim($key), "\0", ':');
self::$_output .= "\n" . $spaces . " [$keyDisplay] => "; self::$_output .= "\n" . $spaces . " [$keyDisplay] => ";
self::dumpInternal($value, $level + 1); self::dumpInternal($value, $level + 1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment