Skip to content

Commit daf3e7f

Browse files
authored
Merge pull request #5412 from kenjis/fix-docs-files.rst
docs: improve files.rst
2 parents b350d76 + 78cf411 commit daf3e7f

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

user_guide_src/source/libraries/files.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ Moving Files
9696
Each file can be moved to its new location with the aptly named ``move()`` method. This takes the directory to move
9797
the file to as the first parameter::
9898

99-
$file->move(WRITEPATH.'uploads');
99+
$file->move(WRITEPATH . 'uploads');
100100

101101
By default, the original filename was used. You can specify a new filename by passing it as the second parameter::
102102

103103
$newName = $file->getRandomName();
104-
$file->move(WRITEPATH.'uploads', $newName);
104+
$file->move(WRITEPATH . 'uploads', $newName);
105105

106106
The move() method returns a new File instance that for the relocated file, so you must capture the result if the
107107
resulting location is needed::
108108

109-
$file = $file->move(WRITEPATH.'uploads');
109+
$file = $file->move(WRITEPATH . 'uploads');
110110

111111
****************
112112
File Collections
@@ -136,8 +136,7 @@ When your collection is complete, you can use ``get()`` to retrieve the final li
136136
echo 'My files: ' . implode(PHP_EOL, $files->get());
137137
echo 'I have ' . count($files) . ' files!';
138138

139-
foreach ($files as $file)
140-
{
139+
foreach ($files as $file) {
141140
echo 'Moving ' . $file->getBasename() . ', ' . $file->getSizeByUnit('mb');
142141
$file->move(WRITABLE . $file->getRandomName());
143142
}
@@ -150,7 +149,7 @@ Starting a Collection
150149
**__construct(string[] $files = [])**
151150

152151
The constructor accepts an optional array of file paths to use as the initial collection. These are passed to
153-
**add()** so any files supplied by child classes in the **$files** will remain.
152+
``add()`` so any files supplied by child classes in the ``$files`` will remain.
154153

155154
**define()**
156155

@@ -181,17 +180,17 @@ Inputting Files
181180
Adds all files indicated by the path or array of paths. If the path resolves to a directory then ``$recursive``
182181
will include sub-directories.
183182

184-
**addFile(string $file)**
183+
**addFile(string $file)** /
185184
**addFiles(array $files)**
186185

187186
Adds the file or files to the current list of input files. Files are absolute paths to actual files.
188187

189-
**removeFile(string $file)**
188+
**removeFile(string $file)** /
190189
**removeFiles(array $files)**
191190

192191
Removes the file or files from the current list of input files.
193192

194-
**addDirectory(string $directory, bool $recursive = false)**
193+
**addDirectory(string $directory, bool $recursive = false)** /
195194
**addDirectories(array $directories, bool $recursive = false)**
196195

197196
Adds all files from the directory or directories, optionally recursing into sub-directories. Directories are
@@ -200,7 +199,7 @@ absolute paths to actual directories.
200199
Filtering Files
201200
===============
202201

203-
**removePattern(string $pattern, string $scope = null)**
202+
**removePattern(string $pattern, string $scope = null)** /
204203
**retainPattern(string $pattern, string $scope = null)**
205204

206205
Filters the current file list through the pattern (and optional scope), removing or retaining matched

0 commit comments

Comments
 (0)