Finish documenting SplFileInfo:

* Change voice to active third person, present tense.
* Document getPerms, getRealPath, openFile, getPathInfo.
* Add examples for setFileClass, setInfoClass.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@269177 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Brett Bieber 2008-11-17 15:57:33 +00:00
parent b8810c7db9
commit e767ed0564
25 changed files with 138 additions and 94 deletions

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getatime" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getATime</refname>
<refpurpose>Get last access time of the file</refpurpose>
<refpurpose>Gets last access time of the file</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry xml:id="splfileinfo.getbasename" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getBasename</refname>
<refpurpose>Get the base name of the file</refpurpose>
<refpurpose>Gets the base name of the file</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getfileinfo" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getFileInfo</refname>
<refpurpose>Get an SplFileInfo object for the file</refpurpose>
<refpurpose>Gets an SplFileInfo object for the file</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getfilename" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getFilename</refname>
<refpurpose>Get the filename</refpurpose>
<refpurpose>Gets the filename</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -14,7 +14,7 @@
<void />
</methodsynopsis>
<para>
Get the filename without any path information.
Gets the filename without any path information.
</para>
</refsect1>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry xml:id="splfileinfo.getgroup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getGroup</refname>
<refpurpose>Get the file group</refpurpose>
<refpurpose>Gets the file group</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getinode" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getInode</refname>
<refpurpose>Get the inode for the file</refpurpose>
<refpurpose>Gets the inode for the file</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getlinktarget" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getLinkTarget</refname>
<refpurpose>Get the target of a link</refpurpose>
<refpurpose>Gets the target of a link</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -14,7 +14,7 @@
<void />
</methodsynopsis>
<para>
Get the target of a filesystem link.
Gets the target of a filesystem link.
</para>
<note>
<para>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getowner" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getOwner</refname>
<refpurpose>Get the owner of the file</refpurpose>
<refpurpose>Gets the owner of the file</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry xml:id="splfileinfo.getpath" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getPath</refname>
<refpurpose>Get the path without filename</refpurpose>
<refpurpose>Gets the path without filename</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getpathinfo" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getPathInfo</refname>
<refpurpose>Get an SplFileInfo object for the path</refpurpose>
<refpurpose>Gets an SplFileInfo object for the path</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getpathname" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getPathname</refname>
<refpurpose>Get the path to the file</refpurpose>
<refpurpose>Gets the path to the file</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -39,7 +39,7 @@
<![CDATA[
<?php
$info = new SplFileInfo('/usr/bin/php');
var_dump($info->getPathName());
var_dump($info->getPathname());
?>
]]>
</programlisting>

View file

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="splfileinfo.getperms" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getPerms</refname>
<refpurpose>The getPerms purpose</refpurpose>
<refpurpose>Gets file permissions</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>SplFileInfo::getPerms</methodname>
<modifier>public</modifier> <type>int</type><methodname>SplFileInfo::getPerms</methodname>
<void />
</methodsynopsis>
<para>
The method description goes here.
Gets the file permissions for the file.
</para>
</refsect1>
@ -26,7 +26,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Description...
Returns the file permissions.
</para>
</refsect1>
@ -38,29 +38,25 @@
<programlisting role="php">
<![CDATA[
<?php
/* ... */
$info = new SplFileInfo('/tmp');
echo substr(sprintf('%o', $info->getPerms()), -4);
$info = new SplFileInfo(__FILE__);
echo substr(sprintf('%o', $info->getPerms()), -4);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
1777
0644
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Classname::Method</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getrealpath" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getRealPath</refname>
<refpurpose>The getRealPath purpose</refpurpose>
<refpurpose>Gets absolute path to file</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -14,7 +14,7 @@
<void />
</methodsynopsis>
<para>
The method description goes here.
This method expands all symbolic links, resolves relative references and returns the real path to the file.
</para>
</refsect1>
@ -26,7 +26,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Description...
Returns the path to the file.
</para>
</refsect1>
@ -38,14 +38,19 @@
<programlisting role="php">
<![CDATA[
<?php
/* ... */
$info = new SplFileInfo('/..//./../../'.__FILE__);
var_dump($info->getRealPath());
$info = new SplFileInfo('/tmp');
var_dump($info->getRealPath());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
string(28) "/private/tmp/phptempfile.php"
string(12) "/private/tmp"
]]>
</screen>
</example>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.getsize" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getSize</refname>
<refpurpose>Get the size of the file</refpurpose>
<refpurpose>Gets file size</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.gettype" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::getType</refname>
<refpurpose>Get the entry's file type.</refpurpose>
<refpurpose>Gets file type</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.isdir" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::isDir</refname>
<refpurpose>Check if the file is a directory</refpurpose>
<refpurpose>Tells if the file is a directory</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.isexecutable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::isExecutable</refname>
<refpurpose>Check if the file is executable</refpurpose>
<refpurpose>Tells if the file is executable</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -37,11 +37,13 @@
<title><function>SplFileInfo::isExecutable</function> example</title>
<programlisting role="php">
<![CDATA[
<?php $d = new SplFileInfo('/usr/bin/php'); var_dump($d->isExecutable());
$d = new SplFileInfo('/usr/bin');
var_dump($d->isExecutable());
$d = new SplFileInfo('foo');
var_dump($d->isExecutable());
<?php $info = new SplFileInfo('/usr/bin/php'); var_dump($info->isExecutable());
$info = new SplFileInfo('/usr/bin');
var_dump($info->isExecutable());
$info = new SplFileInfo('foo');
var_dump($info->isExecutable());
?>
]]>
</programlisting>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.isfile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::isFile</refname>
<refpurpose>Check if the object references a regular file</refpurpose>
<refpurpose>Tells if the object references a regular file</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -37,10 +37,10 @@
<title><function>SplFileInfo::isFile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php $d = new SplFileInfo(__FILE__); var_dump($d->isFile());
<?php $info = new SplFileInfo(__FILE__); var_dump($info->isFile());
$d = new SplFileInfo(dirname(__FILE__));
var_dump($d->isFile());
$info = new SplFileInfo(dirname(__FILE__));
var_dump($info->isFile());
?>
]]>
</programlisting>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.islink" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::isLink</refname>
<refpurpose>Check if the file is a link</refpurpose>
<refpurpose>Tells if the file is a link</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.isreadable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::isReadable</refname>
<refpurpose>Check if file is readable</refpurpose>
<refpurpose>Tells if file is readable</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -37,7 +37,8 @@
<title><function>SplFileInfo::isReadable</function> example</title>
<programlisting role="php">
<![CDATA[
<?php $d = new SplFileInfo(__FILE__); var_dump($d->isReadable()); $d = new SplFileInfo('foo'); var_dump($d->isReadable());
<?php $info = new SplFileInfo(__FILE__); var_dump($info->isReadable());
$info = new SplFileInfo('foo'); var_dump($info->isReadable());
?>
]]>
</programlisting>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.iswritable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::isWritable</refname>
<refpurpose>Check if the entry is writeable</refpurpose>
<refpurpose>Tells if the entry is writeable</refpurpose>
</refnamediv>
<refsect1 role="description">

View file

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="splfileinfo.openfile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::openFile</refname>
<refpurpose>The openFile purpose</refpurpose>
<refpurpose>Gets an SplFileObject object for the file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>SplFileInfo::openFile</methodname>
<modifier>public</modifier> <type>SplFileObject</type><methodname>SplFileInfo::openFile</methodname>
<methodparam choice="opt"><type>string</type><parameter>open_mode</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>use_include_path</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>context</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>use_include_path</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
</methodsynopsis>
<para>
The method description goes here.
@ -86,7 +86,8 @@
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Classname::Method</methodname></member>
<member>SplFileObject</member>
<member><function>stream_context_create</function></member>
</simplelist>
</para>
</refsect1>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="splfileinfo.setfileclass" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::setFileClass</refname>
<refpurpose>Set the class name used with <methodname>SplFileInfo::openFile()</methodname></refpurpose>
<refpurpose>Sets the class name used with <methodname>SplFileInfo::openFile()</methodname></refpurpose>
</refnamediv>
<refsect1 role="description">
@ -27,7 +27,7 @@
<term><parameter>class_name</parameter></term>
<listitem>
<para>
The class name to be used when openFile() is called.
The class name to use when openFile() is called.
</para>
</listitem>
</varlistentry>
@ -39,7 +39,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Description...
&return.void;
</para>
</refsect1>
@ -51,14 +51,20 @@
<programlisting role="php">
<![CDATA[
<?php
/* ... */
// Create a class extending SplFileObject
class MyFoo extends SplFileObject {}
$info = new SplFileInfo(__FILE__);
// Set the class to use
$info->setFileClass('MyFoo');
var_dump($info->openFile());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
object(MyFoo)#2 (0) { }
]]>
</screen>
</example>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="splfileinfo.setinfoclass" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>SplFileInfo::setInfoClass</refname>
<refpurpose>Set the class used with getFileInfo and getPathInfo</refpurpose>
<refpurpose>Sets the class used with getFileInfo and getPathInfo</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -28,7 +28,7 @@
<term><parameter>class_name</parameter></term>
<listitem>
<para>
The class name to be used.
The class name to use.
</para>
</listitem>
</varlistentry>
@ -40,7 +40,35 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Description...
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>SplFileInfo::setFileClass</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// Define a class which extends SplFileInfo
class MyFoo extends SplFileInfo {}
$info = new SplFileInfo('foo');
// Set the class name to use
$info->setInfoClass('MyFoo');
var_dump($info->getFileInfo());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
object(MyFoo)#2 (0) { }
]]>
</screen>
</example>
</para>
</refsect1>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="splfileinfo.tostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
@ -38,18 +38,23 @@
<programlisting role="php">
<![CDATA[
<?php
$info = SplFileInfo('foo');
echo $info->__toString().PHP_EOL;
$info = SplFileInfo('/usr/bin/php');
echo $info->__toString();
$info = new SplFileInfo('foo');
var_dump($info->__toString());
echo $info.PHP_EOL;
$info = new SplFileInfo('/usr/bin/php');
var_dump($info->__toString());
echo $info.PHP_EOL;
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
string(3) "foo"
foo
/usr/bin/php
string(12) "/usr/bin/php"
/usr/bin/php
]]>
</screen>
</example>