- Added initial documentation for SplTypes. SplEnum, SplBook and SplType are

yet to come.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@260472 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
David Coallier 2008-05-30 15:38:22 +00:00
parent 46f4ba6e2d
commit 8a0f811a0e
7 changed files with 431 additions and 0 deletions

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- State: new -->
<book xml:id="book.spl_types" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>SPL_Types</title>
<!-- {{{ preface -->
<preface xml:id="intro.spl_types">
&reftitle.intro;
<para>
This extension aims at helping people making PHP a stronger typed
language. It provides different typehandling classes as such as
integer, float, double, enum, etc.
</para>
&warn.experimental;
</preface>
<!-- }}} -->
&reference.spl_types.reference;
&reference.spl_types.splint;
&reference.spl_types.splfloat;
</book>
<!-- 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
indent-tabs-mode:nil
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
-->

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<section xml:id="spl_types.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
<para>
&pecl.info;
<link xlink:href="http://pecl.php.net/package/spl_types">http://pecl.php.net/package/spl_types</link>
</para>
<para>
pecl install spl_types
</para>
</section>
<!-- 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
indent-tabs-mode:nil
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
-->

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<reference xml:id="ref.spl_types" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>SPL_Types &Functions;</title>
<titleabbrev>SPL_Types</titleabbrev>
</reference>
<!-- 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
indent-tabs-mode:nil
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
-->

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<reference xml:id="class.splfloat" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The SplFloat class</title>
<titleabbrev>SplFloat</titleabbrev>
<partintro>
<!-- {{{ splfloat intro -->
<section xml:id="splfloat.intro">
&reftitle.intro;
<para>
The SplFloat class is used to enforce strong typing of the float type. By instantiating this
class, you insure that your variable is a float and will remain a float.
</para>
</section>
<!-- }}} -->
<section xml:id="splfloat.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>SplFloat</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>SplFloat</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">Methods</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.splfloat')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[1])" />
</classsynopsis>
</section>
</partintro>
</reference>
<!-- 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
indent-tabs-mode:nil
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
-->

View file

@ -0,0 +1,103 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<refentry xml:id="splfloat.construct" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SplFloat::__construct</refname>
<refpurpose>Constructs a float object type</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<constructorsynopsis>
<methodname>SplFloat::__construct</methodname>
<void />
</constructorsynopsis>
<para>
This constructs a new object of type float.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<term><parameter>input</parameter></term>
<listitem>
<para>
The <parameter>input</parameter> parameter accepts a <type>float</type>
or an <type>integer</type>. If you pass an integer, it will be converted
to <type>float</type>.
</para>
</listitem>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>SplFloat::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$float = new SplFloat(3.154);
$newFloat = new SplFloat(3);
try {
$float = 'Try to cast a string value for fun';
} catch (UnexpectedValueException $uve) {
echo $uve->getMessage() . PHP_EOL;
}
var_dump($float);
var_dump($newFloat);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Value not a float
object(SplFloat)#1 (1) {
["__default"]=>
float(3.154)
}
object(SplFloat)#2 (1) {
["__default"]=>
float(3)
}
]]>
</screen>
</example>
</para>
</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
indent-tabs-mode:nil
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
-->

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<reference xml:id="class.splint" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The SplInt class</title>
<titleabbrev>SplInt</titleabbrev>
<partintro>
<!-- {{{ splint intro -->
<section xml:id="splint.intro">
&reftitle.intro;
<para>
The SplInt class is used to enforce strong typing of the integer type. By instantiating this
class, you insure that your variable is an integer and will remain an integer.
</para>
</section>
<!-- }}} -->
<section xml:id="splint.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>SplInt</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>SplInt</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">Methods</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.splint')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[1])" />
</classsynopsis>
</section>
</partintro>
</reference>
<!-- 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
indent-tabs-mode:nil
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
-->

View file

@ -0,0 +1,98 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<refentry xml:id="splint.construct" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SplInt::__construct</refname>
<refpurpose>Constructs an integer object type</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<constructorsynopsis>
<methodname>SplInt::__construct</methodname>
<void />
</constructorsynopsis>
<para>
This constructs a new object of type float.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<term><parameter>input</parameter></term>
<listitem>
<para>
The <parameter>input</parameter> parameter accepts an <type>integer</type>
It will throw an UnexpectedValueException if you pass anything else.
</para>
</listitem>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>SplInt::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$int = new SplInt(94);
try {
$int = 'Try to cast a string value for fun';
} catch (UnexpectedValueException $uve) {
echo $uve->getMessage() . PHP_EOL;
}
var_dump($int);
echo $int; // Outputs 94
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Value not an integer
object(SplInt)#1 (1) {
["__default"]=>
int(94)
}
94
]]>
</screen>
</example>
</para>
</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
indent-tabs-mode:nil
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
-->