mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-13 22:06:51 +08:00
Improved strtr calls
This commit is contained in:
@ -61,7 +61,7 @@ class CodeFile extends Object
|
||||
*/
|
||||
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->id = md5($this->path);
|
||||
if (is_file($path)) {
|
||||
|
@ -42,7 +42,7 @@ class BaseFileHelper
|
||||
*/
|
||||
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) {
|
||||
return $path;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class BaseVarDumper
|
||||
$spaces = str_repeat(' ', $level * 4);
|
||||
self::$_output .= "$className#$id\n" . $spaces . '(';
|
||||
foreach ((array) $var as $key => $value) {
|
||||
$keyDisplay = strtr(trim($key), ["\0" => ':']);
|
||||
$keyDisplay = strtr(trim($key), "\0", ':');
|
||||
self::$_output .= "\n" . $spaces . " [$keyDisplay] => ";
|
||||
self::dumpInternal($value, $level + 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user