8000 rename $fileSystem to $filesystem · symfony/symfony-docs@cc0986a · GitHub
[go: up one dir, main page]

Skip to content

Commit cc0986a

Browse files
committed
rename $fileSystem to $filesystem
1 parent 7ca5b75 commit cc0986a

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

components/filesystem.rst

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ endpoint for filesystem operations::
2626
use Symfony\Component\Filesystem\Filesystem;
2727
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
2828

29-
$fileSystem = new Filesystem();
29+
$filesystem = new Filesystem();
3030

3131
try {
32-
$fileSystem->mkdir(sys_get_temp_dir().'/'.random_int(0, 1000));
32+
$filesystem->mkdir(sys_get_temp_dir().'/'.random_int(0, 1000));
3333
} catch (IOExceptionInterface $exception) {
3434
echo "An error occurred while creating your directory at ".$exception->getPath();
3535
}
@@ -53,7 +53,7 @@ mkdir
5353
On POSIX filesystems, directories are created with a default mode value
5454
`0777`. You can use the second argument to set your own mode::
5555

56-
$fileSystem->mkdir('/tmp/photos', 0700);
56+
$filesystem->mkdir('/tmp/photos', 0700);
5757

5858
.. note::
5959

@@ -79,11 +79,11 @@ presence of one or more files or directories and returns ``false`` if any of
7979
them is missing::
8080

8181
// if this absolute directory exists, returns true
82-
$fileSystem->exists('/tmp/photos');
82+
$filesystem->exists('/tmp/photos');
8383

8484
// if rabbit.jpg exists and bottle.png does not exist, returns false
8585
// non-absolute paths are relative to the directory where the running PHP script is stored
86-
$fileSystem->exists(['rabbit.jpg', 'bottle.png']);
86+
$filesystem->exists(['rabbit.jpg', 'bottle.png']);
8787

8888
.. note::
8989

@@ -100,10 +100,10 @@ source modification date is later than the target. This behavior can be overridd
100100
by the third boolean argument::
101101

102102
// works only if image-ICC has been modified after image.jpg
103-
$fileSystem->copy('image-ICC.jpg', 'image.jpg');
103+
$filesystem->copy('image-ICC.jpg', 'image.jpg');
104104

105105
// image.jpg will be overridden
106-
$fileSystem->copy('image-ICC.jpg', 'image.jpg', true);
106+
$filesystem->copy('image-ICC.jpg', 'image.jpg', true);
107107

108108
touch
109109
~~~~~
@@ -113,11 +113,11 @@ modification time for a file. The current time is used by default. You can set
113113
your own with the second argument. The third argument is the access time::
114114

115115
// sets modification time to the current timestamp
116-
$fileSystem->touch('file.txt');
116+
$filesystem->touch('file.txt');
117117
// sets modification time 10 seconds in the future
118-
$fileSystem->touch('file.txt', time() + 10);
118+
$filesystem->touch('file.txt', time() + 10);
119119
// sets access time 10 seconds in the past
120-
$fileSystem->touch('file.txt', time(), time() - 10);
120+
$filesystem->touch('file.txt', time(), time() - 10);
121121

122122
.. note::
123123

@@ -131,9 +131,9 @@ chown
131131
a file. The third argument is a boolean recursive option::
132132

133133
// sets the owner of the lolcat video to www-data
134-
$fileSystem->chown('lolcat.mp4', 'www-data');
134+
$filesystem->chown('lolcat.mp4', 'www-data');
135135
// changes the owner of the video directory recursively
136-
$fileSystem->chown('/video', 'www-data', true);
136+
$filesystem->chown('/video', 'www-data', true);
137137

138138
.. note::
139139

@@ -147,9 +147,9 @@ chgrp
147147
a file. The third argument is a boolean recursive option::
148148

149149
// sets the group of the lolcat video to nginx
150-
$fileSystem->chgrp('lolcat.mp4', 'nginx');
150+
$filesystem->chgrp('lolcat.mp4', 'nginx');
151151
// changes the group of the video directory recursively
152-
$fileSystem->chgrp('/video', 'nginx', true);
152+
$filesystem->chgrp('/video', 'nginx', true);
153153

154154
.. note::
155155

@@ -163,9 +163,9 @@ chmod
163163
permissions of a file. The fourth argument is a boolean recursive option::
164164

165165
// sets the mode of the video to 0600
166-
$fileSystem->chmod('video.ogg', 0600);
166+
$filesystem->chmod('video.ogg', 0600);
167167
// changes the mod of the src directory recursively
168-
$fileSystem->chmod('src', 0700, 0000, true);
168+
$filesystem->chmod('src', 0700, 0000, true);
169169

170170
.. note::
171171

@@ -178,7 +178,7 @@ remove
178178
:method:`Symfony\\Component\\Filesystem\\Filesystem::remove` deletes files,
179179
directories and symlinks::
180180

181-
$fileSystem->remove(['symlink', '/path/to/directory', 'activity.log']);
181+
$filesystem->remove(['symlink', '/path/to/directory', 'activity.log']);
182182

183183
.. note::
184184

@@ -192,9 +192,9 @@ rename
192192
of a single file or directory::
193193

194194
// renames a file
195-
$fileSystem->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg');
195+
$filesystem->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg');
196196
// renames a directory
197-
$fileSystem->rename('/tmp/files', '/path/to/store/files');
197+
$filesystem->rename('/tmp/files', '/path/to/store/files');
198198

199199
symlink
200200
~~~~~~~
@@ -204,10 +204,10 @@ symbolic link from the target to the destination. If the filesystem does not
204204
support symbolic links, a third boolean argument is available::
205205

206206
// creates a symbolic link
207-
$fileSystem->symlink('/path/to/source', '/path/to/destination');
207+
$filesystem->symlink('/path/to/source', '/path/to/destination');
208208
// duplicates the source directory if the filesystem
209209
// does not support symbolic links
210-
$fileSystem->symlink('/path/to/source', '/path/to/destination', true);
210+
$filesystem->symlink('/path/to/source', '/path/to/destination', true);
211211

212212
readlink
213213
~~~~~~~~
@@ -227,10 +227,10 @@ The :method:`Symfony\\Component\\Filesystem\\Filesystem::readlink` method provid
227227
by the Filesystem component always behaves in the same way::
228228

229229
// returns the next direct target of the link without considering the existence of the target
230-
$fileSystem->readlink('/path/to/link');
230+
$filesystem->readlink('/path/to/link');
231231

232232
// returns its absolute fully resolved final version of the target (if there are nested links, they are resolved)
233-
$fileSystem->readlink('/path/to/link', true);
233+
$filesystem->readlink('/path/to/link', true);
234234

235235
Its behavior is the following::
236236

@@ -251,12 +251,12 @@ makePathRelative
251251
absolute paths and returns the relative path from the second path to the first one::
252252

253253
// returns '../'
254-
$fileSystem->makePathRelative(
254+
$filesystem->makePathRelative(
255255
'/var/lib/symfony/src/Symfony/',
256256
'/var/lib/symfony/src/Symfony/Component'
257257
);
258258
// returns 'videos/'
259-
$fileSystem->makePathRelative('/tmp/videos', '/tmp')
259+
$filesystem->makePathRelative('/tmp/videos', '/tmp')
260260

261261
mirror
262262
~~~~~~
@@ -266,7 +266,7 @@ contents of the source directory into the target one (use the
266266
:method:`Symfony\\Component\\Filesystem\\Filesystem::copy` method to copy single
267267
files)::
268268

269-
$fileSystem->mirror('/path/to/source', '/path/to/target');
269+
$filesystem->mirror('/path/to/source', '/path/to/target');
270270

271271
isAbsolutePath
272272
~~~~~~~~~~~~~~
@@ -275,13 +275,13 @@ isAbsolutePath
275275
``true`` if the given path is absolute, ``false`` otherwise::
276276

277277
// returns true
278-
$fileSystem->isAbsolutePath('/tmp');
278+
$filesystem->isAbsolutePath('/tmp');
279279
// returns true
280-
$fileSystem->isAbsolutePath('c:\\Windows');
280+
$filesystem->isAbsolutePath('c:\\Windows');
281281
// returns false
282-
$fileSystem->isAbsolutePath('tmp');
282+
$filesystem->isAbsolutePath('tmp');
283283
// returns false
284-
$fileSystem->isAbsolutePath('../dir');
284+
$filesystem->isAbsolutePath('../dir');
285285

286286
tempnam
287287
~~~~~~~
@@ -300,7 +300,7 @@ file first and then moves it to the new file location when it's finished.
300300
This means that the user will always see either the complete old file or
301301
complete new file (but never a partially-written file)::
302302

303-
$fileSystem->dumpFile('file.txt', 'Hello World');
303+
$filesystem->dumpFile('file.txt', 'Hello World');
304304

305305
The ``file.txt`` file contains ``Hello World`` now.
306306

@@ -315,7 +315,7 @@ appendToFile
315315
:method:`Symfony\\Component\\Filesystem\\Filesystem::appendToFile` adds new
316316
contents at the end of some file::
317317

318-
$fileSystem->appendToFile('logs.txt', 'Email sent to user@example.com');
318+
$filesystem->appendToFile('logs.txt', 'Email sent to user@example.com');
319319

320320
If either the file or its containing directory doesn't exist, this method
321321
creates them before appending the contents.

0 commit comments

Comments
 (0)
0