Skip to content

Commit bec953a

Browse files
committed
Merge pull request #2591 from WouterJ/clean_filesystem_docs
Cleaned the FileSystem docs
2 parents beb3665 + b03e479 commit bec953a

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

components/filesystem.rst

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ endpoint for filesystem operations::
5151
Mkdir
5252
~~~~~
5353

54-
Mkdir creates directory. On posix filesystems, directories are created with a
55-
default mode value `0777`. You can use the second argument to set your own mode::
54+
:method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir` creates directory.
55+
On posix filesystems, directories are created with a default mode value
56+
`0777`. You can use the second argument to set your own mode::
5657

5758
$fs->mkdir('/tmp/photos', 0700);
5859

@@ -64,8 +65,8 @@ default mode value `0777`. You can use the second argument to set your own mode:
6465
Exists
6566
~~~~~~
6667

67-
Exists checks for the presence of all files or directories and returns false if a
68-
file is missing::
68+
:method:`Symfony\\Component\\Filesystem\\Filesystem::exists` checks for the
69+
presence of all files or directories and returns false if a file is missing::
6970

7071
// this directory exists, return true
7172
$fs->exists('/tmp/photos');
@@ -81,9 +82,10 @@ file is missing::
8182
Copy
8283
~~~~
8384

84-
This method is used to copy files. If the target already exists, the file is
85-
copied only if the source modification date is later than the target. This
86-
behavior can be overridden by the third boolean argument::
85+
:method:`Symfony\\Component\\Filesystem\\Filesystem::copy` is used to copy
86+
files. If the target already exists, the file is copied only if the source
87+
modification date is later than the target. This behavior can be overridden by
88+
the third boolean argument::
8789

8890
// works only if image-ICC has been modified after image.jpg
8991
$fs->copy('image-ICC.jpg', 'image.jpg');
@@ -94,9 +96,9 @@ behavior can be overridden by the third boolean argument::
9496
Touch
9597
~~~~~
9698

97-
Touch sets access and modification time for a file. The current time is used by
98-
default. You can set your own with the second argument. The third argument is
99-
the access time::
99+
:method:`Symfony\\Component\\Filesystem\\Filesystem::touch` sets access and
100+
modification time for a file. The current time is used by default. You can set
101+
your own with the second argument. The third argument is the access time::
100102

101103
// set modification time to the current timestamp
102104
$fs->touch('file.txt');
@@ -113,8 +115,8 @@ the access time::
113115
Chown
114116
~~~~~
115117

116-
Chown is used to change the owner of a file. The third argument is a boolean
117-
recursive option::
118+
:method:`Symfony\\Component\\Filesystem\\Filesystem::chown` is used to change
119+
the owner of a file. The third argument is a boolean recursive option::
118120

119121
// set the owner of the lolcat video to www-data
120122
$fs->chown('lolcat.mp4', 'www-data');
@@ -129,8 +131,8 @@ recursive option::
129131
Chgrp
130132
~~~~~
131133

132-
Chgrp is used to change the group of a file. The third argument is a boolean
133-
recursive option::
134+
:method:`Symfony\\Component\\Filesystem\\Filesystem::chgrp` is used to change
135+
the group of a file. The third argument is a boolean recursive option::
134136

135137
// set the group of the lolcat video to nginx
136138
$fs->chgrp('lolcat.mp4', 'nginx');
@@ -146,8 +148,8 @@ recursive option::
146148
Chmod
147149
~~~~~
148150

149-
Chmod is used to change the mode of a file. The fourth argument is a boolean
150-
recursive option::
151+
:method:`Symfony\\Component\\Filesystem\\Filesystem::chmod` is used to change
152+
the mode of a file. The fourth argument is a boolean recursive option::
151153

152154
// set the mode of the video to 0600
153155
$fs->chmod('video.ogg', 0600);
@@ -162,7 +164,8 @@ recursive option::
162164
Remove
163165
~~~~~~
164166

165-
Remove let's you remove files, symlink, directories easily::
167+
:method:`Symfony\\Component\\Filesystem\\Filesystem::remove` let's you remove
168+
files, symlink, directories easily::
166169

167170
$fs->remove(array('symlink', '/path/to/directory', 'activity.log'));
168171

@@ -174,7 +177,8 @@ Remove let's you remove files, symlink, directories easily::
174177
Rename
175178
~~~~~~
176179

177-
Rename is used to rename files and directories::
180+
:method:`Symfony\\Component\\Filesystem\\Filesystem::rename` is used to rename
181+
files and directories::
178182

179183
//rename a file
180184
$fs->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg');
@@ -184,8 +188,9 @@ Rename is used to rename files and directories::
184188
symlink
185189
~~~~~~~
186190

187-
Creates a symbolic link from the target to the destination. If the filesystem
188-
does not support symbolic links, a third boolean argument is available::
191+
:method:`Symfony\\Component\\Filesystem\\Filesystem::symlink` creates a
192+
symbolic link from the target to the destination. If the filesystem does not
193+
support symbolic links, a third boolean argument is available::
189194

190195
// create a symbolic link
191196
$fs->symlink('/path/to/source', '/path/to/destination');
@@ -196,7 +201,8 @@ does not support symbolic links, a third boolean argument is available::
196201
makePathRelative
197202
~~~~~~~~~~~~~~~~
198203

199-
Return the relative path of a directory given another one::
204+
:method:`Symfony\\Component\\Filesystem\\Filesystem::makePathRelative` returns
205+
the relative path of a directory given another one::
200206

201207
// returns '../'
202208
$fs->makePathRelative(
@@ -209,14 +215,16 @@ Return the relative path of a directory given another one::
209215
mirror
210216
~~~~~~
211217

212-
Mirrors a directory::
218+
:method:`Symfony\\Component\\Filesystem\\Filesystem::mirror` mirrors a
219+
directory::
213220

214221
$fs->mirror('/path/to/source', '/path/to/target');
215222

216223
isAbsolutePath
217224
~~~~~~~~~~~~~~
218225

219-
isAbsolutePath returns true if the given path is absolute, false otherwise::
226+
:method:`Symfony\\Component\\Filesystem\\Filesystem::isAbsolutePath` returns
227+
``true`` if the given path is absolute, false otherwise::
220228

221229
// return true
222230
$fs->isAbsolutePath('/tmp');
@@ -236,9 +244,9 @@ thrown.
236244

237245
.. note::
238246

239-
Prior to version 2.1, :method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir`
240-
returned a boolean and did not throw exceptions. As of 2.1, a
241-
:class:`Symfony\\Component\\Filesystem\\Exception\\IOException` is
242-
thrown if a directory creation fails.
247+
Prior to version 2.1, ``mkdir`` returned a boolean and did not throw
248+
exceptions. As of 2.1, a
249+
:class:`Symfony\\Component\\Filesystem\\Exception\\IOException` is thrown
250+
if a directory creation fails.
243251

244252
.. _`Packagist`: https://packagist.org/packages/symfony/filesystem

0 commit comments

Comments
 (0)