cvs: peardoc /hu/chapters standards.xml
| From: | Norbert Mocsnik | Date: | Sun, 19 Jun 2005 09:16:43 +0000 |
| Subject: | cvs: peardoc /hu/chapters standards.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-6370@lists.php.net to get a copy of this message | ||
norbert_m Sun Jun 19 05:16:43 2005 EDT
Modified files:
/peardoc/hu/chapters standards.xml
Log:
syncing to EN-Revision 1.35
http://cvs.php.net/diff.php/peardoc/hu/chapters/standards.xml?r1=1.11&r2=1.12&ty=u Index: peardoc/hu/chapters/standards.xml diff -u peardoc/hu/chapters/standards.xml:1.11 peardoc/hu/chapters/standards.xml:1.12 --- peardoc/hu/chapters/standards.xml:1.11 Sat Jun 18 20:04:57 2005 +++ peardoc/hu/chapters/standards.xml Sun Jun 19 05:16:43 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-2" ?> -<!-- EN-Revision: 1.28 Maintainer: norbert_m Status: partial --> +<!-- EN-Revision: 1.35 Maintainer: norbert_m Status: partial --> <chapter id="standards"> <title>Kódolási szabályok</title> <note> @@ -170,10 +170,14 @@ <sect1 id="standards.comments"> <title>Megjegyzések (kommentek)</title> <para> - Az inline dokumentáció kövesse a Javadoc-hoz hasonló PHPDoc konvenciót. - További információ a PHPDoc-ról a - <ulink url="&url.phpdocumentor;">&url.phpdocumentor;</ulink> címen - található. + Teljes inline dokumentációs komment blokkokat (docblock-ok) + kell készíteni. A dokumentációs blokkok PEAR-csomagokkal kapcsolatos + részletezését lásd a Kézikönyv kódolási szabályainak + <link linkend="standards.sample">Példa Fájl</link> és a + <link linkend="standards.header">Fejléc komment blokkok</link> + fejezeteiben. + További információ a + <ulink url="&url.phpdocumentor;">phpDocumentor</ulink> weboldalán érhető el. </para> <para> Dokumentálásnál általános szabály, hogy amiről nem kívánunk leírást @@ -221,50 +225,331 @@ <sect1 id="standards.header"> <title>Fejléc komment blokkok</title> <para> - Minden forrásnyelvi fájlnak a PEAR core disztribúcióban a következő - fejléc komment blokkot kell tartalmaznia: + A PEAR raktár minden forrásnyelvi fájljának tartalmaznia + kell egy <quote>oldal-szintű</quote> dokumentációs blokkot minden fájl + tetején, és <quote>osztály-szintű</quote> dokumentációs blokkokat közvetlenül + minden osztály definíciója felett. Példák dokumentációs blokkokra: <programlisting role="php"> -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ -// +----------------------------------------------------------------------+ -// | PHP version 4 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2004 The PHP Group | -// +----------------------------------------------------------------------+ -// | This source file is subject to version 3.0 of the PHP license, | -// | that is bundled with this package in the file LICENSE, and is | -// | available through the world-wide-web at the following url: | -// | http://www.php.net/license/3_0.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | license@php.net so we can mail you a copy immediately. | -// +----------------------------------------------------------------------+ -// | Authors: Original Author <author@example.com> | -// | Your Name <you@example.com> | -// +----------------------------------------------------------------------+ -// -// $Id:$ -</programlisting> - </para> - <para> - Nincs határozott szabály annak eldöntésére, hogy mikor kerüljön sor - egy új közreműködő nevének felvételére a készítők listájába egy adott - forrásfájlban. Általánosságban azt mondhatjuk, hogy ehhez a - változtatásoknak a <quote>jelentős</quote> kategóriába kell esniük (kb. - 10-20% változás a kódban). Kivételek tehetők függvények újraírásánál, vagy - új logika kialakításában történő közreműködésnél. - </para> - <para> - Egyszerű kódátszervezés vagy foltkészítések nem teszik szükségessé - új közreműködő felvételét a készítők listájába. - </para> - <para> - A PEAR core raktárán kívül eső fájlok is hasonló fejléccel kezdődjenek, - megjelölve a szerzői jogra és a licenszre vonatkozó szabályokat, valamint - a készítőket. Minden fájl tartalmazza a kommenteket a következetesség - érdekében. + <![CDATA[ +<?php +/** + * Short description for file + * + * Long description for file (if any)... + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.0 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_0.txt. If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category CategoryName + * @package PackageName + * @author Original Author <author@example.com> + * @author Another Author <another@example.com> + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: ]]>$<![CDATA[Id:$ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since File available since Release 1.2.0 + * @deprecated File deprecated in Release 2.0.0 + */ + +/* + * Place includes, constant defines and $_GLOBAL settings here. + * Make sure they have appropriate docblocks to avoid phpDocumentor + * construing they are documented by the page-level docblock. + */ + +/** + * Short description for class + * + * Long description for class (if any)... + * + * @category CategoryName + * @package PackageName + * @author Original Author <author@example.com> + * @author Another Author <another@example.com> + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: @package_version@ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since Class available since Release 1.2.0 + * @deprecated Class deprecated in Release 2.0.0 + */ +class foo +{ +} + +?> + ]]> + </programlisting> </para> - </sect1> + <sect2 id="standards.header.variable"> + <title>Required Tags That Have Variable Content</title> + <variablelist> + <varlistentry> + <term>Short Descriptions</term> + <listitem> + <para> + Short descriptions must be provided for all docblocks. + They should be a quick sentence, not the name of the item. + Please read the Coding Standard's + <link linkend="standards.sample"> + Sample File</link> about how to write good descriptions. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>PHP Versions</term> + <listitem> + <para> + One of the following must go in the page-level docblock: + </para> + <informalexample> + <programlisting role="docblock">. + * PHP version 4 + * PHP version 5 + * PHP versions 4 and 5 + </programlisting> + </informalexample> + </listitem> + </varlistentry> + + <varlistentry> + <term>@license</term> + <listitem> + <para> + There are several possible licenses. One of the + following must be picked and placed in the page-level + and class-level docblocks: + </para> + <informalexample> + <programlisting role="docblock">. + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @license http://www.freebsd.org/copyright/freebsd-license.html BSD License (2 Clause) + * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) + * @license http://www.freebsd.org/copyright/license.html BSD License (4 Clause) + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + </programlisting> + </informalexample> + <para> + For more information, see the PEAR Group's + <ulink url="&url.pear.group.licenses;"> + Licensing Announcement</ulink>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>@link</term> + <listitem> + <para> + The following must be used in both the page-level and + class-level docblocks. Of course, change + <quote>PackageName</quote> to the name of your package. + This ensures the generated documentation links back your package. + </para> + <informalexample> + <programlisting role="docblock">. + * @link http://pear.php.net/package/PackageName + </programlisting> + </informalexample> + </listitem> + </varlistentry> + + <varlistentry> + <term>@author</term> + <listitem> + <para> + There's no hard rule to determine when a new code + contributor should be added to the list of authors + for a given source file. In general, their changes + should fall into the "substantial" category (meaning + somewhere around 10% to 20% of code changes). + Exceptions could be made for rewriting functions or + contributing new logic. + </para> + <para> + Simple code reorganization or bug fixes would not + justify the addition of a new individual to the + list of authors. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>@since</term> + <listitem> + <para> + This tag is required when a file or class is added + after the package's initial release. Do not use it + in an initial release. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>@deprecated</term> + <listitem> + <para> + This tag is required when a file or class is no + longer used but has been left in place for + backwards compatibility. + </para> + </listitem> + </varlistentry> + + </variablelist> + </sect2> + + <sect2 id="standards.header.optional"> + <title>Optional Tags</title> + <variablelist> + <varlistentry> + <term>@copyright</term> + <listitem> + <para> + Feel free to apply whatever copyrights you desire. + When formatting this tag, the year should be in + four digit format and if a span of years is involved, + use a hyphen between the earliest and latest year. + The copyright holder can be you, a list of people, a + company, the PHP Group, etc. Examples: + </para> + <informalexample> + <programlisting role="docblock">. + * @copyright 2003 John Doe and Jennifer Buck + * @copyright 2001-2004 John Doe + * @copyright 1997-2004 The PHP Group + * @copyright 2001-2004 XYZ Corporation + </programlisting> + </informalexample> + </listitem> + </varlistentry> + + <varlistentry> + <term>License Summary</term> + <listitem> + <para> + If you are using the PHP License, use the summary text + provided above. If another license is being used, + please remove the PHP License summary. Feel free to + substitute it with text appropriate to your license, + though to keep things easy to locate, please preface + the text with <literal>LICENSE: </literal>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>@see</term> + <listitem> + <para> + Add a @see tag when you want to refer users to other + sections of the package's documentation. If you have + multiple items, separate them with commas rather than + adding multiple @see tags. + </para> + </listitem> + </varlistentry> + + </variablelist> + </sect2> + + <sect2 id="standards.header.order"> + <title>Order and Spacing</title> + <para> + To ease long term readability of PEAR source code, the + text and tags must conform to the order and spacing + provided in the example above. This standard is + adopted from the JavaDoc standard. + </para> + </sect2> + + <sect2 id="standards.header.version"> + <title>@package_version@ Usage</title> + <para> + There are two ways to implement the + @package_version@ replacements. The procedure depends on + whether you write your own package.xml files or if you + use the PackageFileManager. + </para> + <para> + For those authoring package.xml files directly, add a + <replace> element for each file. The XML for + such would look something like this: + </para> + <informalexample> + <programlisting role="xml"> + <![CDATA[ +<file name="Class.php"> + <replace from="@package_version@" to="version" type="package-info" /> +</file> + ]]> + </programlisting> + </informalexample> + <para> + Maintainers using the PackageFileManager need to + call <function>addReplacement</function> for each file: + </para> + <informalexample> + <programlisting role="php"> + <![CDATA[ +$pkg->addReplacement('filename.php', 'package-info', + '@package_version@', 'version'); + ]]> + </programlisting> + </informalexample> + </sect2> + + <sect2 id="standards.header.transition"> + <title>Transition Policy</title> + <variablelist> + <varlistentry> + <term>Existing Small Packages</term> + <listitem> + <para> + Existing packages that have only a few files are required + to adopt these docblocks before the next release. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Existing Large Packages</term> + <listitem> + <para> + Existing packages with many files are encouraged to + adopt the new headers as soon as possible. When such + packages come out with a new major version upgrade, + these docblocks must be implemented therein. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>New and Unreleased Packages</term> + <listitem> + <para> + New packages and existing packages which have no + releases yet must include these docblocks before + their first release. + </para> + </listitem> + </varlistentry> + + </variablelist> + </sect2> + + </sect1> <sect1 id="standards.cvs"> <title>A CVS használata</title> <simpara> @@ -515,70 +800,91 @@ </sect1> <sect1 id="standards.sample"> - <title>Sample File</title> + <title>Sample File (including Docblock Comment standards)</title> <para> - The <command>Id</command> CVS keyword you see in the - example below contains the data for the file used to - create the document you are reading now. When creating - your own PEAR scripts, replace the data there with a - blank keyword: <literal>$Id:$</literal> + The source code of PEAR packages are read by thousands + of people. Also, it is likely other people will become + developers on your package at some point in the future. + Therefore, it is important to make life easier for + everyone by formatting the code and docblocks in + standardized ways. People can then quickly find the + information they are looking for because it is in the + expected location. Your cooperation is appreciated. </para> + <para> + Each docblock in the example contains many details about writing + Docblock Comments. Following those instructions + is important for two reasons. First, when docblocks + are easy to read, users and developers can quickly + ascertain what your code does. Second, the PEAR + website now contains the phpDocumentor generated + documentation for each release of each package, so + keeping things straight here means the API docs on + the website will be useful. + </para> <para> - Please take note of the vertical and horizontal spacing. - They are part of the standard. - </para> - <para> - The <quote>fold markers</quote> (<literal>// {{{</literal> and - <literal>// }}}</literal>) are optional. If you aren't using - fold markers, remove <literal>foldmethod=marker</literal> - from the vim header. - </para> - <para> - The example contains many details about writing - Docblock Comments. Following those instructions - is important for two reasons. First, when docblocks - are easy to read, users and developers can quickly - ascertain what your code does. Second, the PEAR - website now contains the phpDocumentor generated - documentation for each release of each package, so - keeping things straight here means the API docs on - the website will be useful. - </para> + Please take note of the vertical and horizontal spacing. + They are part of the standard. + </para> + <para> + The <quote>fold markers</quote> (<literal>// {{{</literal> and + <literal>// }}}</literal>) are optional. If you aren't using + fold markers, remove <literal>foldmethod=marker</literal> + from the vim header. + </para> <para> <programlisting role="php"> <![CDATA[ <?php - /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */ - // +----------------------------------------------------------------------+ - // | PHP version 4 | - // +----------------------------------------------------------------------+ - // | Copyright (c) 1997-2004 The PHP Group | - // +----------------------------------------------------------------------+ - // | This source file is subject to version 3.0 of the PHP license, | - // | that is bundled with this package in the file LICENSE, and is | - // | available through the world-wide-web at the following url: | - // | http://www.php.net/license/3_0.txt. | - // | If you did not receive a copy of the PHP license and are unable to | - // | obtain it through the world-wide-web, please send a note to | - // | license@php.net so we can mail you a copy immediately. | - // +----------------------------------------------------------------------+ - // | Authors: Original Author <author@example.com> | - // | Your Name <you@example.com> | - // +----------------------------------------------------------------------+ - // - // $Id: standards.xml,v 1.11 2005/06/19 00:04:57 norbert_m Exp $ - - require_once 'PEAR.php'; - - // {{{ constants - +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Short description for file + * + * Long description for file (if any)... + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.0 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_0.txt. If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category CategoryName + * @package PackageName + * @author Original Author <author@example.com> * @author Another Author <another@example.com> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: ]]>$<![CDATA[Id:$ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since File available since Release 1.2.0 + * @deprecated File deprecated in Release 2.0.0 + */ + /** * This is a "Docblock Comment," also known as a "docblock." The class' * docblock, below, contains a complete description of how to write these. */ + require_once 'PEAR.php'; + + // {{{ constants + + /** + * Methods return this if they succeed + */ define('NET_SAMPLE_OK', 1); - - // }}} + + // }}} + + // {{{ GLOBALS + + /** + * The number of objects created + * @global int $GLOBALS['NET_SAMPLE_Count'] + */ + $GLOBALS['NET_SAMPLE_Count'] = 0; + + // }}} + // {{{ Net_Sample /** @@ -615,13 +921,16 @@ * Please use them in the order they appear here. phpDocumentor has * several other tags available, feel free to use them. * - * @category categoryname - * @package packagename - * @author Original Author <author@example.com> - * @version $Id: standards.xml,v 1.11 2005/06/19 00:04:57 norbert_m Exp $ - * @access public - * @see NetOther, Net_Sample::Net_Sample() - * @since Class available since Release 1.2.0 + * @category CategoryName + * @package PackageName + * @author Original Author <author@example.com> + * @author Another Author <another@example.com> + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: @package_version@ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since Class available since Release 1.2.0 * @deprecated Class deprecated in Release 2.0.0 */ class Net_Sample @@ -702,13 +1011,24 @@ * when an error happens, say 'object' rather than 'mixed.' Use * 'void' if nothing is returned. * + * Here's an example of how to format examples: + * <sample> + * require_once 'Net/Sample.php'; + * + * $s = new Net_Sample(); + * if (PEAR::isError($s)) { + * echo $s->getMessage() . "\n"; + * } + * </sample> + * + * * @param string $arg1 the string to quote * @param int $arg2 an integer of how many problems happened. - * Indent to the description's starting point - * for long ones. + * Indent to the description's starting point + * for long ones. * * @return int the integer of the set mode used. FALSE if foo - * foo could not be set. + * foo could not be set. * @throws exceptionclass [description] * * @access public
http://cvs.php.net/diff.php/peardoc/hu/chapters/standards.xml?r1=1.11&r2=1.12&ty=u Index: peardoc/hu/chapters/standards.xml diff -u peardoc/hu/chapters/standards.xml:1.11 peardoc/hu/chapters/standards.xml:1.12 --- peardoc/hu/chapters/standards.xml:1.11 Sat Jun 18 20:04:57 2005 +++ peardoc/hu/chapters/standards.xml Sun Jun 19 05:16:43 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-2" ?> -<!-- EN-Revision: 1.28 Maintainer: norbert_m Status: partial --> +<!-- EN-Revision: 1.35 Maintainer: norbert_m Status: partial --> <chapter id="standards"> <title>Kódolási szabályok</title> <note> @@ -170,10 +170,14 @@ <sect1 id="standards.comments"> <title>Megjegyzések (kommentek)</title> <para> - Az inline dokumentáció kövesse a Javadoc-hoz hasonló PHPDoc konvenciót. - További információ a PHPDoc-ról a - <ulink url="&url.phpdocumentor;">&url.phpdocumentor;</ulink> címen - található. + Teljes inline dokumentációs komment blokkokat (docblock-ok) + kell készíteni. A dokumentációs blokkok PEAR-csomagokkal kapcsolatos + részletezését lásd a Kézikönyv kódolási szabályainak + <link linkend="standards.sample">Példa Fájl</link> és a + <link linkend="standards.header">Fejléc komment blokkok</link> + fejezeteiben. + További információ a + <ulink url="&url.phpdocumentor;">phpDocumentor</ulink> weboldalán érhető el. </para> <para> Dokumentálásnál általános szabály, hogy amiről nem kívánunk leírást @@ -221,50 +225,331 @@ <sect1 id="standards.header"> <title>Fejléc komment blokkok</title> <para> - Minden forrásnyelvi fájlnak a PEAR core disztribúcióban a következő - fejléc komment blokkot kell tartalmaznia: + A PEAR raktár minden forrásnyelvi fájljának tartalmaznia + kell egy <quote>oldal-szintű</quote> dokumentációs blokkot minden fájl + tetején, és <quote>osztály-szintű</quote> dokumentációs blokkokat közvetlenül + minden osztály definíciója felett. Példák dokumentációs blokkokra: <programlisting role="php"> -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ -// +----------------------------------------------------------------------+ -// | PHP version 4 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2004 The PHP Group | -// +----------------------------------------------------------------------+ -// | This source file is subject to version 3.0 of the PHP license, | -// | that is bundled with this package in the file LICENSE, and is | -// | available through the world-wide-web at the following url: | -// | http://www.php.net/license/3_0.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | license@php.net so we can mail you a copy immediately. | -// +----------------------------------------------------------------------+ -// | Authors: Original Author <author@example.com> | -// | Your Name <you@example.com> | -// +----------------------------------------------------------------------+ -// -// $Id:$ -</programlisting> - </para> - <para> - Nincs határozott szabály annak eldöntésére, hogy mikor kerüljön sor - egy új közreműködő nevének felvételére a készítők listájába egy adott - forrásfájlban. Általánosságban azt mondhatjuk, hogy ehhez a - változtatásoknak a <quote>jelentős</quote> kategóriába kell esniük (kb. - 10-20% változás a kódban). Kivételek tehetők függvények újraírásánál, vagy - új logika kialakításában történő közreműködésnél. - </para> - <para> - Egyszerű kódátszervezés vagy foltkészítések nem teszik szükségessé - új közreműködő felvételét a készítők listájába. - </para> - <para> - A PEAR core raktárán kívül eső fájlok is hasonló fejléccel kezdődjenek, - megjelölve a szerzői jogra és a licenszre vonatkozó szabályokat, valamint - a készítőket. Minden fájl tartalmazza a kommenteket a következetesség - érdekében. + <![CDATA[ +<?php +/** + * Short description for file + * + * Long description for file (if any)... + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.0 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_0.txt. If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category CategoryName + * @package PackageName + * @author Original Author <author@example.com> + * @author Another Author <another@example.com> + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: ]]>$<![CDATA[Id:$ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since File available since Release 1.2.0 + * @deprecated File deprecated in Release 2.0.0 + */ + +/* + * Place includes, constant defines and $_GLOBAL settings here. + * Make sure they have appropriate docblocks to avoid phpDocumentor + * construing they are documented by the page-level docblock. + */ + +/** + * Short description for class + * + * Long description for class (if any)... + * + * @category CategoryName + * @package PackageName + * @author Original Author <author@example.com> + * @author Another Author <another@example.com> + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: @package_version@ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since Class available since Release 1.2.0 + * @deprecated Class deprecated in Release 2.0.0 + */ +class foo +{ +} + +?> + ]]> + </programlisting> </para> - </sect1> + <sect2 id="standards.header.variable"> + <title>Required Tags That Have Variable Content</title> + <variablelist> + <varlistentry> + <term>Short Descriptions</term> + <listitem> + <para> + Short descriptions must be provided for all docblocks. + They should be a quick sentence, not the name of the item. + Please read the Coding Standard's + <link linkend="standards.sample"> + Sample File</link> about how to write good descriptions. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>PHP Versions</term> + <listitem> + <para> + One of the following must go in the page-level docblock: + </para> + <informalexample> + <programlisting role="docblock">. + * PHP version 4 + * PHP version 5 + * PHP versions 4 and 5 + </programlisting> + </informalexample> + </listitem> + </varlistentry> + + <varlistentry> + <term>@license</term> + <listitem> + <para> + There are several possible licenses. One of the + following must be picked and placed in the page-level + and class-level docblocks: + </para> + <informalexample> + <programlisting role="docblock">. + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + * @license http://www.freebsd.org/copyright/freebsd-license.html BSD License (2 Clause) + * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) + * @license http://www.freebsd.org/copyright/license.html BSD License (4 Clause) + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + </programlisting> + </informalexample> + <para> + For more information, see the PEAR Group's + <ulink url="&url.pear.group.licenses;"> + Licensing Announcement</ulink>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>@link</term> + <listitem> + <para> + The following must be used in both the page-level and + class-level docblocks. Of course, change + <quote>PackageName</quote> to the name of your package. + This ensures the generated documentation links back your package. + </para> + <informalexample> + <programlisting role="docblock">. + * @link http://pear.php.net/package/PackageName + </programlisting> + </informalexample> + </listitem> + </varlistentry> + + <varlistentry> + <term>@author</term> + <listitem> + <para> + There's no hard rule to determine when a new code + contributor should be added to the list of authors + for a given source file. In general, their changes + should fall into the "substantial" category (meaning + somewhere around 10% to 20% of code changes). + Exceptions could be made for rewriting functions or + contributing new logic. + </para> + <para> + Simple code reorganization or bug fixes would not + justify the addition of a new individual to the + list of authors. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>@since</term> + <listitem> + <para> + This tag is required when a file or class is added + after the package's initial release. Do not use it + in an initial release. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>@deprecated</term> + <listitem> + <para> + This tag is required when a file or class is no + longer used but has been left in place for + backwards compatibility. + </para> + </listitem> + </varlistentry> + + </variablelist> + </sect2> + + <sect2 id="standards.header.optional"> + <title>Optional Tags</title> + <variablelist> + <varlistentry> + <term>@copyright</term> + <listitem> + <para> + Feel free to apply whatever copyrights you desire. + When formatting this tag, the year should be in + four digit format and if a span of years is involved, + use a hyphen between the earliest and latest year. + The copyright holder can be you, a list of people, a + company, the PHP Group, etc. Examples: + </para> + <informalexample> + <programlisting role="docblock">. + * @copyright 2003 John Doe and Jennifer Buck + * @copyright 2001-2004 John Doe + * @copyright 1997-2004 The PHP Group + * @copyright 2001-2004 XYZ Corporation + </programlisting> + </informalexample> + </listitem> + </varlistentry> + + <varlistentry> + <term>License Summary</term> + <listitem> + <para> + If you are using the PHP License, use the summary text + provided above. If another license is being used, + please remove the PHP License summary. Feel free to + substitute it with text appropriate to your license, + though to keep things easy to locate, please preface + the text with <literal>LICENSE: </literal>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>@see</term> + <listitem> + <para> + Add a @see tag when you want to refer users to other + sections of the package's documentation. If you have + multiple items, separate them with commas rather than + adding multiple @see tags. + </para> + </listitem> + </varlistentry> + + </variablelist> + </sect2> + + <sect2 id="standards.header.order"> + <title>Order and Spacing</title> + <para> + To ease long term readability of PEAR source code, the + text and tags must conform to the order and spacing + provided in the example above. This standard is + adopted from the JavaDoc standard. + </para> + </sect2> + + <sect2 id="standards.header.version"> + <title>@package_version@ Usage</title> + <para> + There are two ways to implement the + @package_version@ replacements. The procedure depends on + whether you write your own package.xml files or if you + use the PackageFileManager. + </para> + <para> + For those authoring package.xml files directly, add a + <replace> element for each file. The XML for + such would look something like this: + </para> + <informalexample> + <programlisting role="xml"> + <![CDATA[ +<file name="Class.php"> + <replace from="@package_version@" to="version" type="package-info" /> +</file> + ]]> + </programlisting> + </informalexample> + <para> + Maintainers using the PackageFileManager need to + call <function>addReplacement</function> for each file: + </para> + <informalexample> + <programlisting role="php"> + <![CDATA[ +$pkg->addReplacement('filename.php', 'package-info', + '@package_version@', 'version'); + ]]> + </programlisting> + </informalexample> + </sect2> + + <sect2 id="standards.header.transition"> + <title>Transition Policy</title> + <variablelist> + <varlistentry> + <term>Existing Small Packages</term> + <listitem> + <para> + Existing packages that have only a few files are required + to adopt these docblocks before the next release. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Existing Large Packages</term> + <listitem> + <para> + Existing packages with many files are encouraged to + adopt the new headers as soon as possible. When such + packages come out with a new major version upgrade, + these docblocks must be implemented therein. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>New and Unreleased Packages</term> + <listitem> + <para> + New packages and existing packages which have no + releases yet must include these docblocks before + their first release. + </para> + </listitem> + </varlistentry> + + </variablelist> + </sect2> + + </sect1> <sect1 id="standards.cvs"> <title>A CVS használata</title> <simpara> @@ -515,70 +800,91 @@ </sect1> <sect1 id="standards.sample"> - <title>Sample File</title> + <title>Sample File (including Docblock Comment standards)</title> <para> - The <command>Id</command> CVS keyword you see in the - example below contains the data for the file used to - create the document you are reading now. When creating - your own PEAR scripts, replace the data there with a - blank keyword: <literal>$Id:$</literal> + The source code of PEAR packages are read by thousands + of people. Also, it is likely other people will become + developers on your package at some point in the future. + Therefore, it is important to make life easier for + everyone by formatting the code and docblocks in + standardized ways. People can then quickly find the + information they are looking for because it is in the + expected location. Your cooperation is appreciated. </para> + <para> + Each docblock in the example contains many details about writing + Docblock Comments. Following those instructions + is important for two reasons. First, when docblocks + are easy to read, users and developers can quickly + ascertain what your code does. Second, the PEAR + website now contains the phpDocumentor generated + documentation for each release of each package, so + keeping things straight here means the API docs on + the website will be useful. + </para> <para> - Please take note of the vertical and horizontal spacing. - They are part of the standard. - </para> - <para> - The <quote>fold markers</quote> (<literal>// {{{</literal> and - <literal>// }}}</literal>) are optional. If you aren't using - fold markers, remove <literal>foldmethod=marker</literal> - from the vim header. - </para> - <para> - The example contains many details about writing - Docblock Comments. Following those instructions - is important for two reasons. First, when docblocks - are easy to read, users and developers can quickly - ascertain what your code does. Second, the PEAR - website now contains the phpDocumentor generated - documentation for each release of each package, so - keeping things straight here means the API docs on - the website will be useful. - </para> + Please take note of the vertical and horizontal spacing. + They are part of the standard. + </para> + <para> + The <quote>fold markers</quote> (<literal>// {{{</literal> and + <literal>// }}}</literal>) are optional. If you aren't using + fold markers, remove <literal>foldmethod=marker</literal> + from the vim header. + </para> <para> <programlisting role="php"> <![CDATA[ <?php - /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */ - // +----------------------------------------------------------------------+ - // | PHP version 4 | - // +----------------------------------------------------------------------+ - // | Copyright (c) 1997-2004 The PHP Group | - // +----------------------------------------------------------------------+ - // | This source file is subject to version 3.0 of the PHP license, | - // | that is bundled with this package in the file LICENSE, and is | - // | available through the world-wide-web at the following url: | - // | http://www.php.net/license/3_0.txt. | - // | If you did not receive a copy of the PHP license and are unable to | - // | obtain it through the world-wide-web, please send a note to | - // | license@php.net so we can mail you a copy immediately. | - // +----------------------------------------------------------------------+ - // | Authors: Original Author <author@example.com> | - // | Your Name <you@example.com> | - // +----------------------------------------------------------------------+ - // - // $Id: standards.xml,v 1.11 2005/06/19 00:04:57 norbert_m Exp $ - - require_once 'PEAR.php'; - - // {{{ constants - +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Short description for file + * + * Long description for file (if any)... + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.0 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_0.txt. If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category CategoryName + * @package PackageName + * @author Original Author <author@example.com> * @author Another Author <another@example.com> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: ]]>$<![CDATA[Id:$ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since File available since Release 1.2.0 + * @deprecated File deprecated in Release 2.0.0 + */ + /** * This is a "Docblock Comment," also known as a "docblock." The class' * docblock, below, contains a complete description of how to write these. */ + require_once 'PEAR.php'; + + // {{{ constants + + /** + * Methods return this if they succeed + */ define('NET_SAMPLE_OK', 1); - - // }}} + + // }}} + + // {{{ GLOBALS + + /** + * The number of objects created + * @global int $GLOBALS['NET_SAMPLE_Count'] + */ + $GLOBALS['NET_SAMPLE_Count'] = 0; + + // }}} + // {{{ Net_Sample /** @@ -615,13 +921,16 @@ * Please use them in the order they appear here. phpDocumentor has * several other tags available, feel free to use them. * - * @category categoryname - * @package packagename - * @author Original Author <author@example.com> - * @version $Id: standards.xml,v 1.11 2005/06/19 00:04:57 norbert_m Exp $ - * @access public - * @see NetOther, Net_Sample::Net_Sample() - * @since Class available since Release 1.2.0 + * @category CategoryName + * @package PackageName + * @author Original Author <author@example.com> + * @author Another Author <another@example.com> + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version Release: @package_version@ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since Class available since Release 1.2.0 * @deprecated Class deprecated in Release 2.0.0 */ class Net_Sample @@ -702,13 +1011,24 @@ * when an error happens, say 'object' rather than 'mixed.' Use * 'void' if nothing is returned. * + * Here's an example of how to format examples: + * <sample> + * require_once 'Net/Sample.php'; + * + * $s = new Net_Sample(); + * if (PEAR::isError($s)) { + * echo $s->getMessage() . "\n"; + * } + * </sample> + * + * * @param string $arg1 the string to quote * @param int $arg2 an integer of how many problems happened. - * Indent to the description's starting point - * for long ones. + * Indent to the description's starting point + * for long ones. * * @return int the integer of the set mode used. FALSE if foo - * foo could not be set. + * foo could not be set. * @throws exceptionclass [description] * * @access public