|
@@ -58,7 +58,7 @@ class Filesystem
|
|
|
->depth(0)
|
|
|
->in($dir);
|
|
|
|
|
|
- return count($finder) === 0;
|
|
|
+ return \count($finder) === 0;
|
|
|
}
|
|
|
|
|
|
public function emptyDirectory($dir, $ensureDirectoryExists = true)
|
|
@@ -116,7 +116,7 @@ class Filesystem
|
|
|
throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
|
|
|
}
|
|
|
|
|
|
- if (!function_exists('proc_open')) {
|
|
|
+ if (!\function_exists('proc_open')) {
|
|
|
return $this->removeDirectoryPhp($directory);
|
|
|
}
|
|
|
|
|
@@ -311,7 +311,7 @@ class Filesystem
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (!function_exists('proc_open')) {
|
|
|
+ if (!\function_exists('proc_open')) {
|
|
|
$this->copyThenRemove($source, $target);
|
|
|
|
|
|
return;
|
|
@@ -369,13 +369,13 @@ class Filesystem
|
|
|
$from = rtrim($from, '/') . '/dummy_file';
|
|
|
}
|
|
|
|
|
|
- if (dirname($from) === dirname($to)) {
|
|
|
+ if (\dirname($from) === \dirname($to)) {
|
|
|
return './'.basename($to);
|
|
|
}
|
|
|
|
|
|
$commonPath = $to;
|
|
|
while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
|
|
|
- $commonPath = strtr(dirname($commonPath), '\\', '/');
|
|
|
+ $commonPath = strtr(\dirname($commonPath), '\\', '/');
|
|
|
}
|
|
|
|
|
|
if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
|
|
@@ -383,10 +383,10 @@ class Filesystem
|
|
|
}
|
|
|
|
|
|
$commonPath = rtrim($commonPath, '/') . '/';
|
|
|
- $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
|
|
|
+ $sourcePathDepth = substr_count(substr($from, \strlen($commonPath)), '/');
|
|
|
$commonPathCode = str_repeat('../', $sourcePathDepth);
|
|
|
|
|
|
- return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
|
|
|
+ return ($commonPathCode . substr($to, \strlen($commonPath))) ?: './';
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -414,7 +414,7 @@ class Filesystem
|
|
|
|
|
|
$commonPath = $to;
|
|
|
while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
|
|
|
- $commonPath = strtr(dirname($commonPath), '\\', '/');
|
|
|
+ $commonPath = strtr(\dirname($commonPath), '\\', '/');
|
|
|
}
|
|
|
|
|
|
if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
|
|
@@ -423,17 +423,17 @@ class Filesystem
|
|
|
|
|
|
$commonPath = rtrim($commonPath, '/') . '/';
|
|
|
if (strpos($to, $from.'/') === 0) {
|
|
|
- return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
|
|
|
+ return '__DIR__ . '.var_export(substr($to, \strlen($from)), true);
|
|
|
}
|
|
|
- $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
|
|
|
+ $sourcePathDepth = substr_count(substr($from, \strlen($commonPath)), '/') + $directories;
|
|
|
if ($staticCode) {
|
|
|
$commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
|
|
|
} else {
|
|
|
$commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
|
|
|
}
|
|
|
- $relTarget = substr($to, strlen($commonPath));
|
|
|
+ $relTarget = substr($to, \strlen($commonPath));
|
|
|
|
|
|
- return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
|
|
|
+ return $commonPathCode . (\strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -484,7 +484,7 @@ class Filesystem
|
|
|
// extract a prefix being a protocol://, protocol:, protocol://drive: or simply drive:
|
|
|
if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
|
|
|
$prefix = $match[1];
|
|
|
- $path = substr($path, strlen($prefix));
|
|
|
+ $path = substr($path, \strlen($prefix));
|
|
|
}
|
|
|
|
|
|
if (substr($path, 0, 1) === '/') {
|
|
@@ -579,7 +579,7 @@ class Filesystem
|
|
|
$cwd = getcwd();
|
|
|
|
|
|
$relativePath = $this->findShortestPath($link, $target);
|
|
|
- chdir(dirname($link));
|
|
|
+ chdir(\dirname($link));
|
|
|
$result = @symlink($relativePath, $link);
|
|
|
|
|
|
chdir($cwd);
|
|
@@ -632,7 +632,7 @@ class Filesystem
|
|
|
|
|
|
$resolved = rtrim($pathname, '/');
|
|
|
|
|
|
- if (!strlen($resolved)) {
|
|
|
+ if (!\strlen($resolved)) {
|
|
|
return $pathname;
|
|
|
}
|
|
|
|