From f646b9c3ee2c3ce6d34ed99a7b9a703c1c9ebbd5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 30 Nov 2021 13:03:40 +0900 Subject: [PATCH 1/3] docs: update sample code coding style --- user_guide_src/source/libraries/files.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/libraries/files.rst b/user_guide_src/source/libraries/files.rst index 76b2e8a6acd8..cf46d8ceb9b5 100644 --- a/user_guide_src/source/libraries/files.rst +++ b/user_guide_src/source/libraries/files.rst @@ -96,17 +96,17 @@ Moving Files Each file can be moved to its new location with the aptly named ``move()`` method. This takes the directory to move the file to as the first parameter:: - $file->move(WRITEPATH.'uploads'); + $file->move(WRITEPATH . 'uploads'); By default, the original filename was used. You can specify a new filename by passing it as the second parameter:: $newName = $file->getRandomName(); - $file->move(WRITEPATH.'uploads', $newName); + $file->move(WRITEPATH . 'uploads', $newName); The move() method returns a new File instance that for the relocated file, so you must capture the result if the resulting location is needed:: - $file = $file->move(WRITEPATH.'uploads'); + $file = $file->move(WRITEPATH . 'uploads'); **************** File Collections @@ -136,8 +136,7 @@ When your collection is complete, you can use ``get()`` to retrieve the final li echo 'My files: ' . implode(PHP_EOL, $files->get()); echo 'I have ' . count($files) . ' files!'; - foreach ($files as $file) - { + foreach ($files as $file) { echo 'Moving ' . $file->getBasename() . ', ' . $file->getSizeByUnit('mb'); $file->move(WRITABLE . $file->getRandomName()); } From afdc97646f6d3e6073d288aca73cdee2ea3ab730 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 30 Nov 2021 13:06:09 +0900 Subject: [PATCH 2/3] docs: decorate method/variable with '``' --- user_guide_src/source/libraries/files.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/files.rst b/user_guide_src/source/libraries/files.rst index cf46d8ceb9b5..04bd317356e2 100644 --- a/user_guide_src/source/libraries/files.rst +++ b/user_guide_src/source/libraries/files.rst @@ -149,7 +149,7 @@ Starting a Collection **__construct(string[] $files = [])** The constructor accepts an optional array of file paths to use as the initial collection. These are passed to -**add()** so any files supplied by child classes in the **$files** will remain. +``add()`` so any files supplied by child classes in the ``$files`` will remain. **define()** From 78cf411974a2b074faf5d91cec2a29fa16868ca1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 30 Nov 2021 13:06:54 +0900 Subject: [PATCH 3/3] docs: add / to separate methods --- user_guide_src/source/libraries/files.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/libraries/files.rst b/user_guide_src/source/libraries/files.rst index 04bd317356e2..6734e98d5fda 100644 --- a/user_guide_src/source/libraries/files.rst +++ b/user_guide_src/source/libraries/files.rst @@ -180,17 +180,17 @@ Inputting Files Adds all files indicated by the path or array of paths. If the path resolves to a directory then ``$recursive`` will include sub-directories. -**addFile(string $file)** +**addFile(string $file)** / **addFiles(array $files)** Adds the file or files to the current list of input files. Files are absolute paths to actual files. -**removeFile(string $file)** +**removeFile(string $file)** / **removeFiles(array $files)** Removes the file or files from the current list of input files. -**addDirectory(string $directory, bool $recursive = false)** +**addDirectory(string $directory, bool $recursive = false)** / **addDirectories(array $directories, bool $recursive = false)** Adds all files from the directory or directories, optionally recursing into sub-directories. Directories are @@ -199,7 +199,7 @@ absolute paths to actual directories. Filtering Files =============== -**removePattern(string $pattern, string $scope = null)** +**removePattern(string $pattern, string $scope = null)** / **retainPattern(string $pattern, string $scope = null)** Filters the current file list through the pattern (and optional scope), removing or retaining matched