Skip to content

Commit c029f40

Browse files
committed
#14 Fix camel case fails
1 parent 0a100d2 commit c029f40

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/PathPreserver.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,31 @@ public function preserve()
8585
$installPathNormalized = $this->filesystem->normalizePath($installPath);
8686

8787
// Check if any path may be affected by modifying the install path.
88-
$relevant_paths = array();
88+
$relevantPaths = array();
8989
foreach ($this->preservePaths as $path) {
9090
$normalizedPath = $this->filesystem->normalizePath($path);
9191
if (static::file_exists($path) && strpos($normalizedPath, $installPathNormalized) === 0) {
92-
$relevant_paths[] = $normalizedPath;
92+
$relevantPaths[] = $normalizedPath;
9393
}
9494
}
9595

9696
// If no paths need to be backed up, we simply proceed.
97-
if (empty($relevant_paths)) {
97+
if (empty($relevantPaths)) {
9898
continue;
9999
}
100100

101101
$unique = $installPath.' '.time();
102-
$cache_root = $this->filesystem->normalizePath($this->cacheDir.'/preserve-paths/'.sha1($unique));
103-
$this->filesystem->ensureDirectoryExists($cache_root);
102+
$cacheRoot = $this->filesystem->normalizePath($this->cacheDir.'/preserve-paths/'.sha1($unique));
103+
$this->filesystem->ensureDirectoryExists($cacheRoot);
104104

105105
// Before we back paths up, we need to make sure, permissions are
106106
// sufficient to that task.
107-
$this->preparePathPermissions($relevant_paths);
107+
$this->preparePathPermissions($relevantPaths);
108108

109-
foreach ($relevant_paths as $original) {
110-
$backup_location = $cache_root.'/'.sha1($original);
111-
$this->filesystem->rename($original, $backup_location);
112-
$this->backups[$original] = $backup_location;
109+
foreach ($relevantPaths as $original) {
110+
$backupLocation = $cacheRoot.'/'.sha1($original);
111+
$this->filesystem->rename($original, $backupLocation);
112+
$this->backups[$original] = $backupLocation;
113113
}
114114
}
115115
}
@@ -125,10 +125,10 @@ public function rollback()
125125
return;
126126
}
127127

128-
foreach ($this->backups as $original => $backup_location) {
128+
foreach ($this->backups as $original => $backupLocation) {
129129
// Remove any code that was placed by the package at the place of
130130
// the original path.
131-
if (static::file_exists($original)) {
131+
if (static::fileExists($original)) {
132132
if (is_dir($original)) {
133133
$this->filesystem->emptyDirectory($original, false);
134134
$this->filesystem->removeDirectory($original);
@@ -143,10 +143,10 @@ public function rollback()
143143
$this->filesystem->ensureDirectoryExists($folder);
144144
// Make sure we can write the file to the folder.
145145
$this->makePathWritable($folder);
146-
$this->filesystem->rename($backup_location, $original);
146+
$this->filesystem->rename($backupLocation, $original);
147147

148-
if ($this->filesystem->isDirEmpty(dirname($backup_location))) {
149-
$this->filesystem->removeDirectory(dirname($backup_location));
148+
if ($this->filesystem->isDirEmpty(dirname($backupLocation))) {
149+
$this->filesystem->removeDirectory(dirname($backupLocation));
150150
}
151151
}
152152

@@ -220,7 +220,7 @@ protected function restorePathPermissions()
220220
* As php can only determine, whether a file or folder exists when the parent
221221
* directory is executable, we need to provide a workaround.
222222
*
223-
* @param $path
223+
* @param string $path
224224
* The path as in file_exists()
225225
*
226226
* @return bool
@@ -229,12 +229,12 @@ protected function restorePathPermissions()
229229
*
230230
* @see file_exists()
231231
*/
232-
public static function file_exists($path)
232+
public static function fileExists($path)
233233
{
234234

235235
// Get all parent directories.
236236
$folders = array();
237-
$reset_perms = array();
237+
$resetPerms = array();
238238
$folder = $path;
239239
while ($folder = dirname($folder)) {
240240
if ($folder === '.' || $folder === '/' || preg_match("/^.:\\\\$/", $folder)) {
@@ -245,16 +245,16 @@ public static function file_exists($path)
245245
$folders[] = $folder;
246246
}
247247

248-
foreach (array_reverse($folders) as $current_folder) {
248+
foreach (array_reverse($folders) as $currentFolder) {
249249
// In the case a parent folder does not exist, the file cannot exist.
250-
if (!is_dir($current_folder)) {
250+
if (!is_dir($currentFolder)) {
251251
$return = false;
252252
break;
253253
} // In the case the folder is really a folder, but not executable, we need
254254
// to change that, so we can check if the file really exists.
255-
elseif (!is_executable($current_folder)) {
256-
$reset_perms[$current_folder] = fileperms($current_folder);
257-
chmod($current_folder, 0755);
255+
elseif (!is_executable($currentFolder)) {
256+
$resetPerms[$currentFolder] = fileperms($currentFolder);
257+
chmod($currentFolder, 0755);
258258
}
259259
}
260260

@@ -263,7 +263,7 @@ public static function file_exists($path)
263263
}
264264

265265
// Reset permissions in reverse order.
266-
foreach (array_reverse($reset_perms, true) as $folder => $mode) {
266+
foreach (array_reverse($resetPerms, true) as $folder => $mode) {
267267
chmod($folder, $mode);
268268
}
269269

0 commit comments

Comments
 (0)