8000 [components][filesystem] Tweaks for #1439 · symfony/symfony-docs@266c9d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 266c9d4

Browse files
committed
[components][filesystem] Tweaks for #1439
1 parent 6ea9f8b commit 266c9d4

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

components/filesystem.rst

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The Filesystem Component
66

77
The Filesystem components provides basic utilities for the filesystem.
88

9+
.. versionadded:: 2.1
10+
The Filesystem Component is new to Symfony 2.1. Previously, the ``Filesystem``
11+
class was located in the ``HttpKernel`` component.
12+
913
Installation
1014
------------
1115

@@ -40,40 +44,37 @@ endpoint for filesystem operations::
4044
:method:`Symfony\\Component\\Filesystem\\Filesystem::remove` and
4145
:method:`Symfony\\Component\\Filesystem\\Filesystem::touch` can receive a
4246
string, an array or any object implementing :phpclass:`\\Traversable` as
43-
target argument.
47+
the target argument.
4448

4549

4650
Mkdir
4751
~~~~~
4852

4953
Mkdir creates directory. On posix filesystems, directories are created with a
50-
default mode value `0777`. You can use the second argument to set your own mode.
54+
default mode value `0777`. You can use the second argument to set your own mode::
5155

5256
$fs->mkdir('/tmp/photos', 0700);
5357

54-
5558
.. note::
5659

57-
You can pass an array or any :phpclass:`\\Traversable` object as the first
60+
You can pass an array or any :phpclass:`Traversable` object as the first
5861
argument.
5962

60-
6163
Exists
6264
~~~~~~
6365

64-
Exists checks the presence of all files or directories and return false if a
65-
file is missing.
66+
Exists checks for the presence of all files or directories and returns false if a
67+
file is missing::
6668

6769
// this directory exists, return true
6870
$fs->exists('/tmp/photos');
6971

7072
// rabbit.jpg exists, bottle.png does not exists, return false
71-
$fs->exists(array('rabbit.jpg', 'bottle.png));
72-
73+
$fs->exists(array('rabbit.jpg', 'bottle.png'));
7374

7475
.. note::
7576

76-
You can pass an array or any :phpclass:`\\Traversable` object as the first
77+
You can pass an array or any :phpclass:`Traversable` object as the first
7778
argument.
7879

7980
Copy
@@ -89,11 +90,10 @@ behavior can be overridden by the third boolean argument::
8990
// image.jpg will be overridden
9091
$fs->copy('image-ICC.jpg', 'image.jpg', true);
9192

92-
9393
Touch
9494
~~~~~
9595

96-
Touch sets access and modification time to a file. The current time is used by
96+
Touch sets access and modification time for a file. The current time is used by
9797
default. You can set your own with the second argument. The third argument is
9898
the access time::
9999

@@ -104,10 +104,9 @@ the access time::
104104
// set access time 10 seconds in the past
105105
$fs->touch('file.txt', time(), time() - 10);
106106

107-
108107
.. note::
109108

110-
You can pass an array or any :phpclass:`\\Traversable` object as the first
109+
You can pass an array or any :phpclass:`Traversable` object as the first
111110
argument.
112111

113112
Chown
@@ -121,10 +120,9 @@ recursive option::
121120
// change the owner of the video directory recursively
122121
$fs->chown('/video', 'www-data', true);
123122

124-
125123
.. note::
126124

127-
You can pass an array or any :phpclass:`\\Traversable` object as the first
125+
You can pass an array or any :phpclass:`Traversable` object as the first
128126
argument.
129127

130128
Chgrp
@@ -141,7 +139,7 @@ recursive option::
141139

142140
.. note::
143141

144-
You can pass an array or any :phpclass:`\\Traversable` object as the first
142+
You can pass an array or any :phpclass:`Traversable` object as the first
145143
argument.
146144

147145
Chmod
@@ -155,10 +153,9 @@ recursive option::
155153
// change the mod of the src directory recursively
156154
$fs->chmod('src', 0700, true);
157155

158-
159156
.. note::
160157

161-
You can pass an array or any :phpclass:`\\Traversable` object as the first
158+
You can pass an array or any :phpclass:`Traversable` object as the first
162159
argument.
163160

164161
Remove
@@ -168,7 +165,6 @@ Remove let's you remove files, symlink, directories easily::
168165

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

171-
172168
.. note::
173169

174170
You can pass an array or any :phpclass:`\\Traversable` object as the first
@@ -177,7 +173,7 @@ Remove let's you remove files, symlink, directories easily::
177173
Rename
178174
~~~~~~
179175

180-
Rename is used to rename file and directories::
176+
Rename is used to rename files and directories::
181177

182178
//rename a file
183179
$fs->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg');
@@ -187,8 +183,8 @@ Rename is used to rename file and directories::
187183
symlink
188184
~~~~~~~
189185

190-
Create a symbolic link from target to destination. If the filesystem does not
191-
support symbolic links, a third boolean argument is available::
186+
Creates a symbolic link from the target to the destination. If the filesystem
187+
does not support symbolic links, a third boolean argument is available::
192188

193189
// create a symbolic link
194190
$fs->symlink('/path/to/source', '/path/to/destination');
@@ -229,11 +225,10 @@ isAbsolutePath returns true if the given path is absolute, false otherwise::
229225
Error Handling
230226
--------------
231227

232-
Whenever something wrong happends, a :phpclass:`\\RuntimeException` is thrown.
233-
228+
Whenever something wrong happens, a :phpclass:`RuntimeException` is thrown.
234229

235230
.. note::
236231

237232
Prior to version 2.1, :method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir`
238-
was returning a boolean and did not throw exceptions. As of 2.1, a
239-
:phpclass:`\\RuntimeException` is thrown if a directory creation fails.
233+
returned a boolean and did not throw exceptions. As of 2.1, a
234+
:phpclass:`RuntimeException` is thrown if a directory creation fails.

0 commit comments

Comments
 (0)
0