cvs: peardoc /ja/package validate.xml /ja/package/php php-codesniffer.xml /ja/package/php/php-codesniffer coding-standard-class.xml
coding-standard-tutorial.xml /ja/package/validate validate_ie.xml /ja/package/validate/validate_ie intro.xml validations.xml

From: Date: Wed, 04 Apr 2007 14:40:02 +0000
Subject: cvs: peardoc /ja/package validate.xml /ja/package/php php-codesniffer.xml /ja/package/php/php-codesniffer coding-standard-class.xml
coding-standard-tutorial.xml /ja/package/validate validate_ie.xml /ja/package/validate/validate_ie intro.xml validations.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-9599@lists.php.net to get a copy of this message
takagi Wed Apr 4 14:40:02 2007 UTC Added files: /peardoc/ja/package/validate/validate_ie validations.xml intro.xml /peardoc/ja/package/validate validate_ie.xml /peardoc/ja/package/php/php-codesniffer coding-standard-class.xml Modified files: /peardoc/ja/package/php/php-codesniffer coding-standard-tutorial.xml /peardoc/ja/package/php php-codesniffer.xml /peardoc/ja/package validate.xml Log: sync with en.

http://cvs.php.net/viewvc.cgi/peardoc/ja/package/php/php-codesniffer/coding-standard-tutorial.xml?r1=1.2&r2=1.3&diff_format=u Index: peardoc/ja/package/php/php-codesniffer/coding-standard-tutorial.xml diff -u peardoc/ja/package/php/php-codesniffer/coding-standard-tutorial.xml:1.2 peardoc/ja/package/php/php-codesniffer/coding-standard-tutorial.xml:1.3 --- peardoc/ja/package/php/php-codesniffer/coding-standard-tutorial.xml:1.2 Sun Jan 21 04:37:58 2007 +++ peardoc/ja/package/php/php-codesniffer/coding-standard-tutorial.xml Wed Apr 4 14:40:01 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> -<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.3 $ --> +<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <refentry id="package.php.php-codesniffer.coding-standard-tutorial"> <refnamediv> <refname>コーディング規約のチュートリアル</refname> @@ -20,7 +20,7 @@ <title>コーディング規約用のディレクトリの作成</title> <para> PHP_CodeSniffer で使用する規約は、すべてコーディング規約に従っている必要があります。 - この規約は、単に PHP_CodeSniffer ディレクトリ配下になければならないというだけのことです。 + この規約とは、PHP_CodeSniffer ディレクトリ配下にある単一のクラスでなければならないということです。 というわけなので、非常に簡単に作成することができます。 今回作成するコーディング規約は <emphasis>MyStandard</emphasis> という名前にしましょう。次のコマンドで、このコーディング規約用のディレクトリ構造を作成します。 @@ -32,7 +32,6 @@ $ cd /path/to/PHP_CodeSniffer/CodeSniffer/Standards $ mkdir MyStandard $ mkdir MyStandard/Sniffs -$ mkdir MyStandard/Tests ]]> </userinput> </screen> @@ -43,9 +42,70 @@ チェック時にコマンドラインで指定するときには、このディレクトリ名を使用します。 サブディレクトリ <filename>Sniffs</filename> には、 このコーディング規約が使用するすべての sniff ファイルを保存します。 - サブディレクトリ <filename>Tests</filename> には、sniff - ファイル用の単体テストを保存します。 </para> + <para> + ディレクトリ構造ができたので、クラスファイルを追加していきましょう。 + このファイルによって PHP_CodeSniffer がコーディング規約の情報を問い合わせられるようになり、 + このディレクトリが sniff を含むものであることを示します。 + </para> + <para> + <screen> + <userinput> +<![CDATA[ +$ touch MyStandardCodingStandard.php +]]> + </userinput> + </screen> + </para> + <para> + <filename>MyStandardCodingStandard.php</filename> ファイルの内容は、 + 次のようになります。 + </para> + <para> + <programlisting role="php"> +<![CDATA[ +<?php +/** + * MyStandard コーディング規約 + * + * PHP version 5 + * + * @category PHP + * @package PHP_CodeSniffer + * @author あなたの名前 <you@domain.net> + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version CVS: $Id: coding-standard-tutorial.xml,v 1.3 2007/04/04 14:40:01 takagi Exp $ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ + +require_once 'PHP/CodeSniffer/Standards/CodingStandard.php'; + + /** + * MyStandard コーディング規約 + * + * @category PHP + * @package PHP_CodeSniffer + * @author あなたの名前 <you@domain.net> + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version Release: @package_version@ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ +class PHP_CodeSniffer_Standards_MyStandard_MyStandardCodingStandard extends PHP_CodeSniffer_Standards_CodingStandard +{ + +}//end class +?> +]]> + </programlisting> + </para> + <note> + <simpara> + コーディング規約クラスは、この例のように空のままにしておくこともできます。 + オーバーライドできるメソッドについての情報は、 + <link linkend="package.php.php-codesniffer.coding-standard-class"> + コーディング規約クラスについてののドキュメント</link> を参照ください。 + </simpara> + </note> </refsect1> <refsect1> @@ -170,7 +230,7 @@ * @package PHP_CodeSniffer * @author Your Name <you@domain.net> * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version CVS: $Id: coding-standard-tutorial.xml,v 1.2 2007/01/21 04:37:58 takagi Exp $ + * @version CVS: $Id: coding-standard-tutorial.xml,v 1.3 2007/04/04 14:40:01 takagi Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ http://cvs.php.net/viewvc.cgi/peardoc/ja/package/php/php-codesniffer.xml?r1=1.2&r2=1.3&diff_format=u Index: peardoc/ja/package/php/php-codesniffer.xml diff -u peardoc/ja/package/php/php-codesniffer.xml:1.2 peardoc/ja/package/php/php-codesniffer.xml:1.3 --- peardoc/ja/package/php/php-codesniffer.xml:1.2 Sat Feb 3 02:25:31 2007 +++ peardoc/ja/package/php/php-codesniffer.xml Wed Apr 4 14:40:01 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> -<!-- EN-Revision: 1.2 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.3 $ --> +<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <sect1 id="package.php.php-codesniffer"> <title>PHP_CodeSniffer</title> <para> @@ -18,6 +18,7 @@ &package.php.php-codesniffer.usage; &package.php.php-codesniffer.advanced-usage; &package.php.php-codesniffer.coding-standard-tutorial; + &package.php.php-codesniffer.coding-standard-class; &package.php.php-codesniffer.faq; </sect1> http://cvs.php.net/viewvc.cgi/peardoc/ja/package/validate.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/ja/package/validate.xml diff -u peardoc/ja/package/validate.xml:1.1 peardoc/ja/package/validate.xml:1.2 --- peardoc/ja/package/validate.xml:1.1 Thu Sep 14 02:21:25 2006 +++ peardoc/ja/package/validate.xml Wed Apr 4 14:40:01 2007 @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.4 Maintainer: takagi Status: ready --> <chapter id="package.validate"> - <title>Validate</title> + <title>検証 (Validate)</title> <para> Validate は、一般的なデータあるいは固有のデータの検証を行います。 @@ -22,6 +22,7 @@ <listitem><para>デンマーク: Validate_DK</para></listitem> <listitem><para>フランス: Validate_FR</para></listitem> <listitem><para>ドイツ: Validate_DE</para></listitem> + <listitem><para>アイルランド: Validate_IE</para></listitem> <listitem><para>アイスランド: Validate_IS</para></listitem> <listitem><para>オランダ: Validate_NL</para></listitem> <listitem><para>ニュージーランド: Validate_NZ</para></listitem> @@ -58,6 +59,7 @@ &package.validate.validate-es; &package.validate.validate-esMX; &package.validate.validate-fr; + &package.validate.validate-ie; &package.validate.validate-in; &package.validate.validate-is; &package.validate.validate-nl; http://cvs.php.net/viewvc.cgi/peardoc/ja/package/validate/validate_ie/validations.xml?view=markup&rev=1.1 Index: peardoc/ja/package/validate/validate_ie/validations.xml +++ peardoc/ja/package/validate/validate_ie/validations.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <!-- $Id: validations.xml,v 1.1 2007/04/04 14:40:01 takagi Exp $ --> <!-- package-release: beta --> <refentry id="package.validate.validate_ie.validations"> <refnamediv> <refname>使用できる検証の一覧</refname> <refpurpose>validate_ie で使用できる検証</refpurpose> </refnamediv> <refsect1 id="package.validate.validate_ie.validations.ssn"> <title>アイルランドの PPSN 番号の検証</title> <para> 個人公共サービス番号 (The Personal Public Service Number (PPS No)) は、 アイルランド共和国の社会家族大臣にかわって 社会家族省の Client Identity Services が発行する ID です。 </para> <refsect2 id="package.validate.validate_ie.validations.ssn.sample"> <title>例</title> <para> <programlisting role="php"> <![CDATA[ <?php // パッケージをインクルードします require_once 'Validate/IE.php'; $badSsn = '012345674'; $result = Validate_IE::ssn($badSsn); echo 'Test ' . $badSsn .' : <br />'; var_export($result); echo '<br /><br />'; $goodSsn = '1234567W'; $result = Validate_IE::ssn($goodSsn); echo 'Test ' . $goodSsn .' : <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> 出力はこのようになります。 <screen> <computeroutput> Test 012345674 : false Test 1234567W : true </computeroutput> </screen> </para> </refsect2> </refsect1> <refsect1 id="package.validate.validate_ie.validations.postcode"> <title>アイルランドの郵便番号の検証</title> <para> アイルランドには郵便番号はありません (2007 年時点。しかし 2008 年からは使われるようになる可能性がある)。 </para> </refsect1> <refsect1 id="package.validate.validate_ie.validations.phonenumber"> <title>電話番号の検証</title> <para> アイルランドの電話番号はアメリカやカナダと似た形式ですが、 アイルランド向けに最適化するためにいくつかの差異があります。 </para> <para> たとえば、ダブリンのコードは 01 ですが コークは 021、ゴールウェーは 091 といった具合になっています。 </para> <para> (xxx) xxx-xxxx や xxx xxx-xxxx といった形式だけでなく、いまや x (xxx) xxx-xxxx、xxx-xxx-xxxx、xxx xxx xxxx、xx xxx xxxx の形式もありえます。またこれらからスペースやダッシュを除いたものも可能です。 </para> <refsect2 id="package.validate.validate_ie.validations.phonenumber.sample"> <title>例</title> <para> <programlisting role="php"> <![CDATA[ <?php // パッケージをインクルードします require_once 'Validate/IE.php'; $phoneNumber = '467875098x'; $result = Validate_IE::phoneNumber($phoneNumber); echo 'Test ' . $phoneNumber .' : <br />'; var_export($result); echo '<br />'; $phoneNumber = '014142438'; $result = Validate_IE::phoneNumber($phoneNumber); echo 'Test ' . $phoneNumber .' : <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> 出力はこのようになります。 <screen> <computeroutput> Test 467875098x : false Test 014142438: true </computeroutput> </screen> </para> </refsect2> <refsect2 id="package.validate.validate_ie.validations.vat.phonenumber.noprefix"> <title>例</title> <para> パラメータつきの例を見てみましょう。 </para> <para> <programlisting role="php"> <![CDATA[ <?php // パッケージをインクルードします require_once 'Validate/IE.php'; $phoneNumber = '87509824'; $result = Validate_IE::phoneNumber($phoneNumber,false); echo 'Test ' . $phoneNumber .' : <br />'; var_export($result); echo '<br /><br />'; $phoneNumber = '8750987'; echo 'Test ' . $phoneNumber .' : <br />'; echo 'With $requireAreaCode false <br />'; $result = Validate_IE::phoneNumber($phoneNumber,false); var_export($result); echo '<br />'; echo 'With $requireAreaCode true<br />'; $result = Validate_IE::phoneNumber($phoneNumber,true); var_export($result); echo '<br /><br />'; $phoneNumber = '(0915)8750987'; echo 'Test ' . $phoneNumber .' : <br />'; echo 'With $requireAreaCode false <br />'; $result = Validate_IE::phoneNumber($phoneNumber,false); var_export($result); echo '<br />'; echo 'With $requireAreaCode true<br />'; $result = Validate_IE::phoneNumber($phoneNumber,true); var_export($result); ?> ]]> </programlisting> </para> <para> 出力はこのようになります。 <screen> <computeroutput> Test 87509824 : true Test 8750987 : With $requireAreaCode false true With $requireAreaCode true false Test (091)8750987 : With $requireAreaCode false false With $requireAreaCode true true </computeroutput> </screen> </para> </refsect2> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/ja/package/validate/validate_ie/intro.xml?view=markup&rev=1.1 Index: peardoc/ja/package/validate/validate_ie/intro.xml +++ peardoc/ja/package/validate/validate_ie/intro.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <!-- $Id: intro.xml,v 1.1 2007/04/04 14:40:01 takagi Exp $ --> <!-- package-release: beta --> <refentry id="package.validate.validate_ie.intro"> <refnamediv> <refname>導入</refname> <refpurpose>validate_IE の導入</refpurpose> </refnamediv> <refsect1 id="package.validate.validate_ie.intro.desc"> &title.desc; <para> このパッケージは、アイルランド固有のデータの検証を行うメソッドを提供します。 </para> <para> </para> </refsect1> <refsect1 id="package.validate.validate_ie.intro.usage"> <title>使用法</title> <refsect2 id="package.validate.validate_ie.intro.usage.general"> <title>一般的な使用法</title> <para> Validate のすべてのモジュールは同じ考えにもとづいて作成されています。 検証メソッドは、結果を boolean で返します。 オプションのパラメータを渡すことで、より強力なチェックを行えるメソッドもあります。 </para> </refsect2> <refsect2 id="package.validate.validate_ie.intro.usage.sample"> <title>例</title> <para> <programlisting role="php"> <![CDATA[ <?php // パッケージをインクルードします require_once 'Validate/IE.php'; ?> ]]> </programlisting> </para> </refsect2> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/ja/package/validate/validate_ie.xml?view=markup&rev=1.1 Index: peardoc/ja/package/validate/validate_ie.xml +++ peardoc/ja/package/validate/validate_ie.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: takagi Status: ready --> <!-- CREDITS: davidc --> <sect1 id="package.validate.validate-ie"> <title>Validate_IE</title> <para> <caution> <para> このパッケージはアルファ版です。 </para> </caution> アイルランド固有の以下のような検証を行うパッケージです。 <orderedlist> <listitem><para>郵便番号</para></listitem> <listitem><para>銀行コード</para></listitem> <listitem><para>SSN/PPSN</para></listitem> <listitem><para>電話番号</para></listitem> <listitem><para>運転免許証番号</para></listitem> <listitem><para>パスポート番号</para></listitem> </orderedlist> </para> <para> See also : <itemizedlist> <listitem> <para> <ulink url="http://pear.php.net/package/Validate_IE/docs/latest/">API ドキュメント</ulink> </para> </listitem> <listitem> <para> <ulink url="http://pear.php.net/package/Validate_IE/">http://pear.php.net 上のページ</ulink> </para> </listitem> </itemizedlist> </para> &package.validate.validate-ie.intro; &package.validate.validate-ie.validations; </sect1> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/ja/package/php/php-codesniffer/coding-standard-class.xml?view=markup&rev=1.1 Index: peardoc/ja/package/php/php-codesniffer/coding-standard-class.xml +++ peardoc/ja/package/php/php-codesniffer/coding-standard-class.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="package.php.php-codesniffer.coding-standard-class"> <refnamediv> <refname>コーディング規約クラスのメソッド</refname> <refpurpose>コーディング規約クラスのメソッドのオーバーライドに関する情報</refpurpose> </refnamediv> <refsect1> <title>導入</title> <para> すべてのコーディング規約は、ひとつのクラスファイルを含みます。 このファイルによって PHP_CodeSniffer がコーディング規約の情報を問い合わせられるようになり、 このディレクトリが sniff を含むものであることを示します。 この手引きでは、コーディング規約のクラスでオーバーライド可能なメソッドについて説明します。 これらのメソッドにより、コーディング規約についてのいろいろな情報を PHP_CodeSniffer に伝えます。 </para> </refsect1> <refsect1> <title>getIncludedSniffs() メソッド</title> <para> このメソッドでは、<filename>Sniffs</filename> ディレクトリで定義した sniff のほかに 別のコーディング規約から取り込む sniff を PHP_CodeSniffer に通知します。 単一の sniff、特定のディレクトリのすべての sniff、 あるいはコーディング規約全体でさえもインクルードすることができます。 </para> <para> 以下のサンプルでは、 <literal>Generic</literal> コーディング規約の <literal>MultipleStatementAlignment</literal> sniff、 <literal>Generic</literal> コーディング規約の <literal>Functions</literal> カテゴリ内のすべての sniff、 そして <literal>PEAR</literal> コーディング規約で定義されているすべての sniff をインクルードしています。 </para> <para> <programlisting role="php"> <![CDATA[ <?php /** * この規約に含める外部 sniff の一覧を返す * * MyStandard コーディング規約では、汎用 sniff の一部と * PEAR コーディング規約全体を使用します * * @return array */ function getIncludedSniffs() { return array( 'PEAR', 'Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff', 'Generic/Sniffs/Functions', ); }//end getIncludedSniffs() ?> ]]> </programlisting> </para> <note> <simpara> コーディング規約全体をインクルードすると、 その規約が別の規約からインクルードしている sniff も同時に取り込まれます。 たとえば <literal>PEAR</literal> コーディング規約では、 いくつかの sniff を <literal>Generic</literal> コーディング規約からインクルードしています。 そのため、<literal>PEAR</literal> コーディング規約全体をインクルードすると これらの sniff もインクルードされることになります。 これにより、既存の規約をもとにした独自の規約を 手早く簡単に作成できるようになります。 </simpara> </note> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
« previous php.pear.doc (#9599) next »