Update docs, add assmble

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@332586 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Xinchen Hui 2014-01-10 03:22:01 +00:00
parent 50a515801e
commit f3ac8a5844
11 changed files with 821 additions and 4 deletions

View file

@ -346,6 +346,7 @@
<function name='yaf_route_interface' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_interface::route' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_interface::assemble;=2.3.0'/>
<function name='yaf_route_static' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_static::match' from='Yaf &gt;=1.0.0'/>
@ -360,22 +361,27 @@
<function name='yaf_route_simple' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_simple::__construct' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_simple::route' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_simple::assemble' from='Yaf &gt;=2.3.0'/>
<function name='yaf_route_supervar' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_supervar::__construct' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_supervar::route' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_supervar::assemble' from='Yaf &gt;=2.3.0'/>
<function name='yaf_route_rewrite' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_rewrite::__construct' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_rewrite::route' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_rewrite::assemble' from='Yaf &gt;=2.3.0'/>
<function name='yaf_route_regex' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_regex::__construct' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_regex::route' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_regex::assemble' from='Yaf &gt;=2.3.0'/>
<function name='yaf_route_map' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_map::__construct' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_map::route' from='Yaf &gt;=1.0.0'/>
<function name='yaf_route_map::assemble' from='Yaf &gt;=2.3.0'/>
<function name='yaf_plugin_abstract' from='Yaf &gt;=1.0.0'/>
<function name='yaf_plugin_abstract::routerstartup' from='Yaf &gt;=1.0.0'/>

View file

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 328221 $ -->
<refentry xml:id="yaf-assemble-interface.assemble" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Route_Interface::assemble</refname>
<refpurpose>assemble a request</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>abstract</modifier> <modifier>public</modifier> <type>string</type><methodname>Yaf_Route_Interface::assemble</methodname>
<methodparam><type>array</type><parameter>info</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
this method returns a url according to the argument info, and append
query strings to the url according to the argument query.
</para>
<para>
a route should implement this method according to its own route rules, and
do a reverse progress.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>info</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</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:"~/.phpdoc/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

@ -16,6 +16,12 @@
<para>
<methodname>Yaf_Route_Interface::route</methodname> is the only method
that a custom route should implement.
<note>
<para>
since of 2.3.0, there is another method should also be implemented,
see <methodname>Yaf_Route_Interface::assemble</methodname>.
</para>
</note>
</para>
<para>
if this method return &true;, then the route process will be end. otherwise,
@ -35,7 +41,6 @@
<methodname>Yaf_Request_Abstract::setRouted</methodname> to make the
request routed at last.
</para>
&warn.undocumented.func;
</refsect1>

View file

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 320072 $ -->
<refentry xml:id="yaf-assemble-map.assemble" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Route_Map::assemble</refname>
<refpurpose>Assemble a url</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>Yaf_Route_Map::assemble</methodname>
<methodparam><type>array</type><parameter>info</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Assmeble a url.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>info</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>Yaf_Route_Map::assemble</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$router = new Yaf_Router();
$route = new Yaf_Route_Map();
$router->addRoute("map", $route);
var_dump($router->getRoute('map')->assemble(
array(
':c' => 'foo_bar'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2'
)
)
);
$route = new Yaf_Route_Map(true, '_');
$router->addRoute("map", $route);
var_dump($router->getRoute('map')->assemble(
array(
':a' => 'foo_bar'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2'
)
)
);
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
string(%d) "/foo/bar?tkey1=tval1&tkey2=tval2"
string(%d) "/foo/bar/_/tkey1/tval1/tkey2/tval2"
]]>
</screen>
</example>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</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:"~/.phpdoc/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,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 320072 $ -->
<refentry xml:id="yaf-assemble-regex.assemble" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Route_Regex::assemble</refname>
<refpurpose>Assemble a url</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>Yaf_Route_Regex::assemble</methodname>
<methodparam><type>array</type><parameter>info</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Assmeble a url.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>info</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>Yaf_Route_Regex::assemble</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$router = new Yaf_Router();
$route = new Yaf_Route_Regex(
"#^/product/([^/]+)/([^/])+#",
array(
'controller' => "product", //route to product controller,
),
array(),
array(),
'/:m/:c/:a'
);
$router->addRoute("regex", $route);
var_dump($router->getRoute('regex')->assemble(
array(
':m' => 'module',
':c' => 'controller',
':a' => 'action'
),
array(
'tkey1' => 'tval1',
'tkey2' =>
'tval2'
)
)
);
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
string(49) "/module/controller/action?tkey1=tval1&tkey2=tval2"
]]>
</screen>
</example>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</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:"~/.phpdoc/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

@ -15,9 +15,9 @@
<methodparam><type>array</type><parameter>route</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>map</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>verify</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>reverse</parameter></methodparam>
</methodsynopsis>
<para>
</para>
</refsect1>
@ -65,6 +65,20 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>reverse</parameter></term>
<listitem>
<para>
a string, used to assemble url, see
<methodname>Yaf_Route_Regex::assemble</methodname>.
<note>
<para>
this parameter is introduced in 2.3.0
</para>
</note>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 320072 $ -->
<refentry xml:id="yaf-assemble-rewrite.assemble" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Route_Rewrite::assemble</refname>
<refpurpose>Assemble a url</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>Yaf_Route_Rewrite::assemble</methodname>
<methodparam><type>array</type><parameter>info</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Assmeble a url.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>info</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>Yaf_Route_Rewrite::assemble</function>example</title>
<programlisting role="php">
<![CDATA[
router = new Yaf_Router();
$route = new Yaf_Route_Rewrite(
"/product/:name/:id/*",
array(
'controller' => "product",
),
array()
);
$router->addRoute("rewrite", $route);
var_dump($router->getRoute('rewrite')->assemble(
array(
':name' => 'foo',
':id' => 'bar',
':tmpkey1' => 'tmpval1'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2'
)
)
);
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
string(57) "/product/foo/bar/tmpkey1/tmpval1/?tkey1=tval1&tkey2=tval2"
]]>
</screen>
</example>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</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:"~/.phpdoc/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

@ -17,8 +17,6 @@
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">

View file

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 320072 $ -->
<refentry xml:id="yaf-assemble-simple.assemble" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Route_Simple::assemble</refname>
<refpurpose>Assemble a url</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>Yaf_Route_Simple::assemble</methodname>
<methodparam><type>array</type><parameter>info</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Assmeble a url.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>info</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>Yaf_Route_Simple::assemble</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$router = new Yaf_Router();
$route = new Yaf_Route_Simple('m', 'c', 'a');
$router->addRoute("simple", $route);
var_dump($router->getRoute('simple')->assemble(
array(
':a' => 'yafaction',
'tkey' => 'tval',
':c' => 'yafcontroller',
':m' => 'yafmodule'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2'
)
));
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
string(64) "?m=yafmodule&c=yafcontroller&a=yafaction&tkey1=tval1&tkey2=tval2"
]]>
</screen>
</example>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</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:"~/.phpdoc/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,125 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 320072 $ -->
<refentry xml:id="yaf-assemble-static.assemble" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Route_Static::assemble</refname>
<refpurpose>Assemble a url</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>Yaf_Route_Static::assemble</methodname>
<methodparam><type>array</type><parameter>info</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Assmeble a url.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>info</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>Yaf_Route_Static::assemble</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$router = new Yaf_Router();
$route = new Yaf_Route_Static();
$router->addRoute("static", $route);
var_dump($router->getRoute('static')->assemble(
array(
':a' => 'yafaction',
'tkey' => 'tval',
':c' => 'yafcontroller',
':m' => 'yafmodule'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2'
)
)
);
var_dump($router->getRoute('static')->assemble(
array(
':a' => 'yafaction',
'tkey' => 'tval',
':c' => 'yafcontroller',
':m' => 'yafmodule'
),
array(
1 => 2,
array(),
)
)
);
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
string(%d) "/yafmodule/yafcontroller/yafaction?tkey1=tval1&tkey2=tval2"
string(%d) "/yafmodule/yafcontroller/yafaction"
]]>
</screen>
</example>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</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:"~/.phpdoc/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,127 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 320072 $ -->
<refentry xml:id="yaf-assemble-supervar.assemble" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Route_Supervar::assemble</refname>
<refpurpose>Assemble a url</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>Yaf_Route_Supervar::assemble</methodname>
<methodparam><type>array</type><parameter>info</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Assmeble a url.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>info</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>Yaf_Route_Supervar::assemble</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$router = new Yaf_Router();
$route = new Yaf_Route_Supervar('r');
$router->addRoute("supervar", $route);
var_dump($router->getRoute('supervar')->assemble(
array(
':a' => 'yafaction',
'tkey' => 'tval',
':c' => 'yafcontroller',
':m' => 'yafmodule'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2'
)
));
try {
var_dump($router->getRoute('supervar')->assemble(
array(
':a' => 'yafaction',
'tkey' => 'tval',
':m' => 'yafmodule'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2',
1 => array(),
)
));
} catch (Exception $e) {
var_dump($e->getMessage());
}
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
string(%d) "?r=/yafmodule/yafcontroller/yafaction&tkey1=tval1&tkey2=tval2"
string(%d) "You need to specify the controller by ':c'"
]]>
</screen>
</example>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</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:"~/.phpdoc/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
-->