cvs: peardoc /hu/chapters standards.xml

From: 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&oacute;dol&aacute;si szab&aacute;lyok</title> <note> @@ -170,10 +170,14 @@ <sect1 id="standards.comments"> <title>Megjegyz&eacute;sek (kommentek)</title> <para> - Az inline dokument&aacute;ci&oacute; k&ouml;vesse a Javadoc-hoz hasonl&oacute; PHPDoc konvenci&oacute;t. - Tov&aacute;bbi inform&aacute;ci&oacute; a PHPDoc-r&oacute;l a - <ulink url="&url.phpdocumentor;">&url.phpdocumentor;</ulink> c&iacute;men - tal&aacute;lhat&oacute;. + Teljes inline dokument&aacute;ci&oacute;s komment blokkokat (docblock-ok) + kell k&eacute;sz&iacute;teni. A dokument&aacute;ci&oacute;s blokkok PEAR-csomagokkal kapcsolatos + r&eacute;szletez&eacute;s&eacute;t l&aacute;sd a K&eacute;zik&ouml;nyv k&oacute;dol&aacute;si szab&aacute;lyainak + <link linkend="standards.sample">P&eacute;lda F&aacute;jl</link> &eacute;s a + <link linkend="standards.header">Fejl&eacute;c komment blokkok</link> + fejezeteiben. + Tov&aacute;bbi inform&aacute;ci&oacute; a + <ulink url="&url.phpdocumentor;">phpDocumentor</ulink> weboldal&aacute;n &eacute;rhet&#337; el. </para> <para> Dokument&aacute;l&aacute;sn&aacute;l &aacute;ltal&aacute;nos szab&aacute;ly, hogy amir&#337;l nem k&iacute;v&aacute;nunk le&iacute;r&aacute;st @@ -221,50 +225,331 @@ <sect1 id="standards.header"> <title>Fejl&eacute;c komment blokkok</title> <para> - Minden forr&aacute;snyelvi f&aacute;jlnak a PEAR core disztrib&uacute;ci&oacute;ban a k&ouml;vetkez&#337; - fejl&eacute;c komment blokkot kell tartalmaznia: + A PEAR rakt&aacute;r minden forr&aacute;snyelvi f&aacute;jlj&aacute;nak tartalmaznia + kell egy <quote>oldal-szint&#369;</quote> dokument&aacute;ci&oacute;s blokkot minden f&aacute;jl + tetej&eacute;n, &eacute;s <quote>oszt&aacute;ly-szint&#369;</quote> dokument&aacute;ci&oacute;s blokkokat k&ouml;zvetlen&uuml;l + minden oszt&aacute;ly defin&iacute;ci&oacute;ja felett. P&eacute;ld&aacute;k dokument&aacute;ci&oacute;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 &lt;author@example.com&gt; | -// | Your Name &lt;you@example.com&gt; | -// +----------------------------------------------------------------------+ -// -// &dollar;Id:&dollar; -</programlisting> - </para> - <para> - Nincs hat&aacute;rozott szab&aacute;ly annak eld&ouml;nt&eacute;s&eacute;re, hogy mikor ker&uuml;lj&ouml;n sor - egy &uacute;j k&ouml;zrem&#369;k&ouml;d&#337; nev&eacute;nek felv&eacute;tel&eacute;re a k&eacute;sz&iacute;t&#337;k list&aacute;j&aacute;ba egy adott - forr&aacute;sf&aacute;jlban. &Aacute;ltal&aacute;noss&aacute;gban azt mondhatjuk, hogy ehhez a - v&aacute;ltoztat&aacute;soknak a <quote>jelent&#337;s</quote> kateg&oacute;ri&aacute;ba kell esni&uuml;k (kb. - 10-20% v&aacute;ltoz&aacute;s a k&oacute;dban). Kiv&eacute;telek tehet&#337;k f&uuml;ggv&eacute;nyek &uacute;jra&iacute;r&aacute;s&aacute;n&aacute;l, vagy - &uacute;j logika kialak&iacute;t&aacute;s&aacute;ban t&ouml;rt&eacute;n&#337; k&ouml;zrem&#369;k&ouml;d&eacute;sn&eacute;l. - </para> - <para> - Egyszer&#369; k&oacute;d&aacute;tszervez&eacute;s vagy foltk&eacute;sz&iacute;t&eacute;sek nem teszik sz&uuml;ks&eacute;gess&eacute; - &uacute;j k&ouml;zrem&#369;k&ouml;d&#337; felv&eacute;tel&eacute;t a k&eacute;sz&iacute;t&#337;k list&aacute;j&aacute;ba. - </para> - <para> - A PEAR core rakt&aacute;r&aacute;n k&iacute;v&uuml;l es&#337; f&aacute;jlok is hasonl&oacute; fejl&eacute;ccel kezd&#337;djenek, - megjel&ouml;lve a szerz&#337;i jogra &eacute;s a licenszre vonatkoz&oacute; szab&aacute;lyokat, valamint - a k&eacute;sz&iacute;t&#337;ket. Minden f&aacute;jl tartalmazza a kommenteket a k&ouml;vetkezetess&eacute;g - &eacute;rdek&eacute;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: ]]>&dollar;<![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 + &lt;replace&gt; 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&aacute;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>&dollar;Id:&dollar;</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: ]]>&dollar;<![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
« previous php.pear.doc (#6370) next »