@@ -85,31 +85,31 @@ public function preserve()
85
85
$ installPathNormalized = $ this ->filesystem ->normalizePath ($ installPath );
86
86
87
87
// Check if any path may be affected by modifying the install path.
88
- $ relevant_paths = array ();
88
+ $ relevantPaths = array ();
89
89
foreach ($ this ->preservePaths as $ path ) {
90
90
$ normalizedPath = $ this ->filesystem ->normalizePath ($ path );
91
91
if (static ::file_exists ($ path ) && strpos ($ normalizedPath , $ installPathNormalized ) === 0 ) {
92
- $ relevant_paths [] = $ normalizedPath ;
92
+ $ relevantPaths [] = $ normalizedPath ;
93
93
}
94
94
}
95
95
96
96
// If no paths need to be backed up, we simply proceed.
97
- if (empty ($ relevant_paths )) {
97
+ if (empty ($ relevantPaths )) {
98
98
continue ;
99
99
}
100
100
101
101
$ 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 );
104
104
105
105
// Before we back paths up, we need to make sure, permissions are
106
106
// sufficient to that task.
107
- $ this ->preparePathPermissions ($ relevant_paths );
107
+ $ this ->preparePathPermissions ($ relevantPaths );
108
108
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 ;
113
113
}
114
114
}
115
115
}
@@ -125,10 +125,10 @@ public function rollback()
125
125
return ;
126
126
}
127
127
128
- foreach ($ this ->backups as $ original => $ backup_location ) {
128
+ foreach ($ this ->backups as $ original => $ backupLocation ) {
129
129
// Remove any code that was placed by the package at the place of
130
130
// the original path.
131
- if (static ::file_exists ($ original )) {
131
+ if (static ::fileExists ($ original )) {
132
132
if (is_dir ($ original )) {
133
133
$ this ->filesystem ->emptyDirectory ($ original , false );
134
134
$ this ->filesystem ->removeDirectory ($ original );
@@ -143,10 +143,10 @@ public function rollback()
143
143
$ this ->filesystem ->ensureDirectoryExists ($ folder );
144
144
// Make sure we can write the file to the folder.
145
145
$ this ->makePathWritable ($ folder );
146
- $ this ->filesystem ->rename ($ backup_location , $ original );
146
+ $ this ->filesystem ->rename ($ backupLocation , $ original );
147
147
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 ));
150
150
}
151
151
}
152
152
@@ -220,7 +220,7 @@ protected function restorePathPermissions()
220
220
* As php can only determine, whether a file or folder exists when the parent
221
221
* directory is executable, we need to provide a workaround.
222
222
*
223
- * @param $path
223
+ * @param string $path
224
224
* The path as in file_exists()
225
225
*
226
226
* @return bool
@@ -229,12 +229,12 @@ protected function restorePathPermissions()
229
229
*
230
230
* @see file_exists()
231
231
*/
232
- public static function file_exists ($ path )
232
+ public static function fileExists ($ path )
233
233
{
234
234
235
235
// Get all parent directories.
236
236
$ folders = array ();
237
- $ reset_perms = array ();
237
+ $ resetPerms = array ();
238
238
$ folder = $ path ;
239
239
while ($ folder = dirname ($ folder )) {
240
240
if ($ folder === '. ' || $ folder === '/ ' || preg_match ("/^.: \\\\$/ " , $ folder )) {
@@ -245,16 +245,16 @@ public static function file_exists($path)
245
245
$ folders [] = $ folder ;
246
246
}
247
247
248
- foreach (array_reverse ($ folders ) as $ current_folder ) {
248
+ foreach (array_reverse ($ folders ) as $ currentFolder ) {
249
249
// In the case a parent folder does not exist, the file cannot exist.
250
- if (!is_dir ($ current_folder )) {
250
+ if (!is_dir ($ currentFolder )) {
251
251
$ return = false ;
252
252
break ;
253
253
} // In the case the folder is really a folder, but not executable, we need
254
254
// 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 );
258
258
}
259
259
}
260
260
@@ -263,7 +263,7 @@ public static function file_exists($path)
263
263
}
264
264
265
265
// Reset permissions in reverse order.
266
- foreach (array_reverse ($ reset_perms , true ) as $ folder => $ mode ) {
266
+ foreach (array_reverse ($ resetPerms , true ) as $ folder => $ mode ) {
267
267
chmod ($ folder , $ mode );
268
268
}
269
269
0 commit comments