12
12
class PathPreserver
13
13
{
14
14
15
- /**
16
- * Temporary file permission to allow moving protected paths.
17
- */
15
+ /**
16
+ * Temporary file permission to allow moving protected paths.
17
+ */
18
18
const FILEPERM = 0755 ;
19
19
20
- /**
21
- * @var string
22
- */
20
+ /**
21
+ * @var string
22
+ */
23
23
protected $ cacheDir ;
24
24
25
- /**
26
- * @var string[]
27
- */
25
+ /**
26
+ * @var string[]
27
+ */
28
28
protected $ installPaths ;
29
29
30
- /**
31
- * @var string[]
32
- */
30
+ /**
31
+ * @var string[]
32
+ */
33
33
protected $ preservePaths ;
34
34
35
- /**
36
- * @var \Composer\Util\FileSystem
37
- */
35
+ /**
36
+ * @var \Composer\Util\FileSystem
37
+ */
38
38
protected $ filesystem ;
39
39
40
- /**
41
- * @var \Composer\IO\IOInterface
42
- */
40
+ /**
41
+ * @var \Composer\IO\IOInterface
42
+ */
43
43
protected $ io ;
44
44
45
- /**
46
- * @var string[string]
47
- */
45
+ /**
46
+ * @var string[string]
47
+ */
48
48
protected $ backups = array ();
49
49
50
- /**
51
- * @var string[string]
52
- */
50
+ /**
51
+ * @var string[string]
52
+ */
53
53
protected $ filepermissions = array ();
54
54
55
- /**
56
- * Constructor.
57
- *
58
- * @param string[] $installPaths
59
- * Array of install paths (must be absolute)
60
- * @param string[] $preservePaths
61
- * Array of preservable paths (must be absolute)
62
- * @param string $cacheDir
63
- * Absolute path to composer cache dir.
64
- * @param \Composer\Util\FileSystem $filesystem
65
- * The filesystem provided by composer to work with.
66
- * @param \Composer\IO\IOInterface $io
67
- * IO interface for writing messages.
68
- */
55
+ /**
56
+ * Constructor.
57
+ *
58
+ * @param string[] $installPaths
59
+ * Array of install paths (must be absolute)
60
+ * @param string[] $preservePaths
61
+ * Array of preservable paths (must be absolute)
62
+ * @param string $cacheDir
63
+ * Absolute path to composer cache dir.
64
+ * @param \Composer\Util\FileSystem $filesystem
65
+ * The filesystem provided by composer to work with.
66
+ * @param \Composer\IO\IOInterface $io
67
+ * IO interface for writing messages.
68
+ */
69
69
public function __construct ($ installPaths , $ preservePaths , $ cacheDir , \Composer \Util \FileSystem $ filesystem , \Composer \IO \IOInterface $ io )
70
70
{
71
71
$ this ->installPaths = array_unique ($ installPaths );
@@ -75,9 +75,9 @@ public function __construct($installPaths, $preservePaths, $cacheDir, \Composer\
75
75
$ this ->io = $ io ;
76
76
}
77
77
78
- /**
79
- * Backs up the paths.
80
- */
78
+ /**
79
+ * Backs up the paths.
80
+ */
81
81
public function preserve ()
82
82
{
83
83
@@ -114,11 +114,11 @@ public function preserve()
114
114
}
115
115
}
116
116
117
- /**
118
- * Restore previously backed up paths.
119
- *
120
- * @see PathPreserver::backupSubpaths()
121
- */
117
+ /**
118
+ * Restore previously backed up paths.
119
+ *
120
+ * @see PathPreserver::backupSubpaths()
121
+ */
122
122
public function rollback ()
123
123
{
124
124
if (empty ($ this ->backups )) {
@@ -158,21 +158,21 @@ public function rollback()
158
158
$ this ->backups = array ();
159
159
}
160
160
161
- /**
162
- * Check if file really exists.
163
- *
164
- * As php can only determine, whether a file or folder exists when the parent
165
- * directory is executable, we need to provide a workaround.
166
- *
167
- * @param string $path
168
- * The path as in file_exists()
169
- *
170
- * @return bool
171
- * Returns TRUE if file exists, like in file_exists(),
172
- * but without restriction.
173
- *
174
- * @see file_exists()
175
- */
161
+ /**
162
+ * Check if file really exists.
163
+ *
164
+ * As php can only determine, whether a file or folder exists when the parent
165
+ * directory is executable, we need to provide a workaround.
166
+ *
167
+ * @param string $path
168
+ * The path as in file_exists()
169
+ *
170
+ * @return bool
171
+ * Returns TRUE if file exists, like in file_exists(),
172
+ * but without restriction.
173
+ *
174
+ * @see file_exists()
175
+ */
176
176
public static function fileExists ($ path )
177
177
{
178
178
@@ -238,11 +238,11 @@ protected function preparePathPermissions($paths)
238
238
}
239
239
}
240
240
241
- /**
242
- * Helper to make path writable.
243
- *
244
- * @param string $path
245
- */
241
+ /**
242
+ * Helper to make path writable.
243
+ *
244
+ * @param string $path
245
+ */
246
246
protected function makePathWritable ($ path )
247
247
{
248
248
// Make parent writable, before we can change the path itself.
@@ -255,11 +255,11 @@ protected function makePathWritable($path)
255
255
chmod ($ path , static ::FILEPERM );
256
256
}
257
257
258
- /**
259
- * Restores path permissions that have been changed before.
260
- *
261
- * @see PathPreserver::preparePathPermissions()
262
- */
258
+ /**
259
+ * Restores path permissions that have been changed before.
260
+ *
261
+ * @see PathPreserver::preparePathPermissions()
262
+ */
263
263
protected function restorePathPermissions ()
264
264
{
265
265
// We restore child permissions first.
0 commit comments