From b03e479d52312bc5c2645c35e22f0ab5773225b2 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 3 May 2013 13:29:00 +0200 Subject: [PATCH] Cleaned the FileSystem docs --- components/filesystem.rst | 62 ++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/components/filesystem.rst b/components/filesystem.rst index 6e5ca5140fa..e3b00c6e8b3 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -51,8 +51,9 @@ endpoint for filesystem operations:: Mkdir ~~~~~ -Mkdir creates directory. On posix filesystems, directories are created with a -default mode value `0777`. You can use the second argument to set your own mode:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir` creates directory. +On posix filesystems, directories are created with a default mode value +`0777`. You can use the second argument to set your own mode:: $fs->mkdir('/tmp/photos', 0700); @@ -64,8 +65,8 @@ default mode value `0777`. You can use the second argument to set your own mode: Exists ~~~~~~ -Exists checks for the presence of all files or directories and returns false if a -file is missing:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::exists` checks for the +presence of all files or directories and returns false if a file is missing:: // this directory exists, return true $fs->exists('/tmp/photos'); @@ -81,9 +82,10 @@ file is missing:: Copy ~~~~ -This method is used to copy files. If the target already exists, the file is -copied only if the source modification date is later than the target. This -behavior can be overridden by the third boolean argument:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::copy` is used to copy +files. If the target already exists, the file is copied only if the source +modification date is later than the target. This behavior can be overridden by +the third boolean argument:: // works only if image-ICC has been modified after image.jpg $fs->copy('image-ICC.jpg', 'image.jpg'); @@ -94,9 +96,9 @@ behavior can be overridden by the third boolean argument:: Touch ~~~~~ -Touch sets access and modification time for a file. The current time is used by -default. You can set your own with the second argument. The third argument is -the access time:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::touch` sets access and +modification time for a file. The current time is used by default. You can set +your own with the second argument. The third argument is the access time:: // set modification time to the current timestamp $fs->touch('file.txt'); @@ -113,8 +115,8 @@ the access time:: Chown ~~~~~ -Chown is used to change the owner of a file. The third argument is a boolean -recursive option:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::chown` is used to change +the owner of a file. The third argument is a boolean recursive option:: // set the owner of the lolcat video to www-data $fs->chown('lolcat.mp4', 'www-data'); @@ -129,8 +131,8 @@ recursive option:: Chgrp ~~~~~ -Chgrp is used to change the group of a file. The third argument is a boolean -recursive option:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::chgrp` is used to change +the group of a file. The third argument is a boolean recursive option:: // set the group of the lolcat video to nginx $fs->chgrp('lolcat.mp4', 'nginx'); @@ -146,8 +148,8 @@ recursive option:: Chmod ~~~~~ -Chmod is used to change the mode of a file. The fourth argument is a boolean -recursive option:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::chmod` is used to change +the mode of a file. The fourth argument is a boolean recursive option:: // set the mode of the video to 0600 $fs->chmod('video.ogg', 0600); @@ -162,7 +164,8 @@ recursive option:: Remove ~~~~~~ -Remove let's you remove files, symlink, directories easily:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::remove` let's you remove +files, symlink, directories easily:: $fs->remove(array('symlink', '/path/to/directory', 'activity.log')); @@ -174,7 +177,8 @@ Remove let's you remove files, symlink, directories easily:: Rename ~~~~~~ -Rename is used to rename files and directories:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::rename` is used to rename +files and directories:: //rename a file $fs->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg'); @@ -184,8 +188,9 @@ Rename is used to rename files and directories:: symlink ~~~~~~~ -Creates a symbolic link from the target to the destination. If the filesystem -does not support symbolic links, a third boolean argument is available:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::symlink` creates a +symbolic link from the target to the destination. If the filesystem does not +support symbolic links, a third boolean argument is available:: // create a symbolic link $fs->symlink('/path/to/source', '/path/to/destination'); @@ -196,7 +201,8 @@ does not support symbolic links, a third boolean argument is available:: makePathRelative ~~~~~~~~~~~~~~~~ -Return the relative path of a directory given another one:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::makePathRelative` returns +the relative path of a directory given another one:: // returns '../' $fs->makePathRelative( @@ -209,14 +215,16 @@ Return the relative path of a directory given another one:: mirror ~~~~~~ -Mirrors a directory:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::mirror` mirrors a +directory:: $fs->mirror('/path/to/source', '/path/to/target'); isAbsolutePath ~~~~~~~~~~~~~~ -isAbsolutePath returns true if the given path is absolute, false otherwise:: +:method:`Symfony\\Component\\Filesystem\\Filesystem::isAbsolutePath` returns +``true`` if the given path is absolute, false otherwise:: // return true $fs->isAbsolutePath('/tmp'); @@ -236,9 +244,9 @@ thrown. .. note:: - Prior to version 2.1, :method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir` - returned a boolean and did not throw exceptions. As of 2.1, a - :class:`Symfony\\Component\\Filesystem\\Exception\\IOException` is - thrown if a directory creation fails. + Prior to version 2.1, ``mkdir`` returned a boolean and did not throw + exceptions. As of 2.1, a + :class:`Symfony\\Component\\Filesystem\\Exception\\IOException` is thrown + if a directory creation fails. .. _`Packagist`: https://packagist.org/packages/symfony/filesystem