added classkit docs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@167013 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Sean Coates 2004-08-22 17:05:41 +00:00
parent 91ab5a49df
commit 58f711238f
8 changed files with 735 additions and 0 deletions

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<section id="classkit.installation">
&reftitle.install;
<para>
&pecl.info;
<ulink url="&url.pecl.package;classkit">&url.pecl.package;classkit</ulink>.
</para>
<para>
In order to use these functions you must install <literal>classkit</literal>
from PECL, by issuing <literal>pear install classkit</literal>
</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,63 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<section id="classkit.constants">
&reftitle.constants;
&extension.constants;
<para>
<variablelist>
<varlistentry>
<term>
<constant>CLASSKIT_ACC_PRIVATE</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Marks the method <literal>private</literal>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>CLASSKIT_ACC_PROTECTED</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Marks the method <literal>protected</literal>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>CLASSKIT_ACC_PUBLIC</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Marks the method <literal>public</literal>
</simpara>
</listitem>
</varlistentry>
</variablelist>
</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,157 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.classkit-method-add">
<refnamediv>
<refname>classkit_method_add</refname>
<refpurpose>Dynamically adds a new method to a given class</refpurpose>
</refnamediv>
<refsect1>
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>classkit_method_add</methodname>
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
<methodparam><type>string</type><parameter>methodname</parameter></methodparam>
<methodparam><type>string</type><parameter>args</parameter></methodparam>
<methodparam><type>string</type><parameter>code</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
<para>
Returns &true; on success, &false; on failure.
</para>
&warn.experimental.func;
</refsect1>
<refsect1>
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>classname</parameter></term>
<listitem>
<para>
The class to which this method will be added
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>methodname</parameter></term>
<listitem>
<para>
The name of the method to add
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>args</parameter></term>
<listitem>
<para>
Comma-delimited list of arguments for the newly-created method
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>code</parameter></term>
<listitem>
<para>
The code to be evaluated when <parameter>methodname</parameter>
is called
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
The type of method to create, can be
<constant>CLASSKIT_ACC_PUBLIC</constant>,
<constant>CLASSKIT_ACC_PROTECTED</constant> or
<constant>CLASSKIT_ACC_PRIVATE</constant>
</para>
<note>
<simpara>
This parameter is only used as of PHP 5, because, prior to this,
all methods were public.
</simpara>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1>
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<!-- No changelog: it's only in PECL. -->
<refsect1>
&reftitle.examples;
<para>
<example>
<title><function>classkit_method_add</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class Example {
function foo() {
echo "foo!\n";
}
}
// create an Example object
$e = new Example();
// Add a new public method
classkit_method_add(
'Example',
'add',
'$num1, $num2',
'return $num1 + $num2;',
CLASSKIT_ACC_PUBLIC
);
// add 12 + 4
echo $e->add(12, 4);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
16
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1>
&reftitle.seealso;
<para>
<function>classkit_method_redefine</function>,
<function>classkit_method_remove</function>,
<function>classkit_method_rename</function>&listendand;
<function>create_function</function>
</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,161 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.classkit-method-redefine">
<refnamediv>
<refname>classkit_method_redefine</refname>
<refpurpose>Dynamically changes the code of the given method</refpurpose>
</refnamediv>
<refsect1>
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>classkit_method_redefine</methodname>
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
<methodparam><type>string</type><parameter>methodname</parameter></methodparam>
<methodparam><type>string</type><parameter>args</parameter></methodparam>
<methodparam><type>string</type><parameter>code</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
<para>
Returns &true; on success, &false; on failure.
</para>
&note.classkit.selfmanipulation;
&warn.experimental.func;
</refsect1>
<refsect1>
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>classname</parameter></term>
<listitem>
<para>
The class in which to redefine the method
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>methodname</parameter></term>
<listitem>
<para>
The name of the method to redefine
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>args</parameter></term>
<listitem>
<para>
Comma-delimited list of arguments for the redefined method
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>code</parameter></term>
<listitem>
<para>
The new code to be evaluated when <parameter>methodname</parameter>
is called
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
The redefined method can be
<constant>CLASSKIT_ACC_PUBLIC</constant>,
<constant>CLASSKIT_ACC_PROTECTED</constant> or
<constant>CLASSKIT_ACC_PRIVATE</constant>
</para>
<note>
<simpara>
This parameter is only used as of PHP 5, because, prior to this,
all methods were public.
</simpara>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1>
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<!-- No changelog: it's only in PECL. -->
<refsect1>
&reftitle.examples;
<para>
<example>
<title><function>classkit_method_redefine</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class Example {
function foo() {
return "foo!\n";
}
}
// create an Example object
$e = new Example();
// output Example::foo() (before redefine)
echo "Before: " . $e->foo();
// Redefine the 'foo' method
classkit_method_redefine(
'Example',
'foo',
'',
'return "bar!\n";',
CLASSKIT_ACC_PUBLIC
);
// output Example::foo() (after redefine)
echo "After: " . $e->foo();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Before: foo!
After: bar!
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1>
&reftitle.seealso;
<para>
<function>classkit_method_add</function>,
<function>classkit_method_remove</function>&listendand;
<function>classkit_method_rename</function>
</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,119 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.classkit-method-remove">
<refnamediv>
<refname>classkit_method_remove</refname>
<refpurpose>Dynamically removes the given method</refpurpose>
</refnamediv>
<refsect1>
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>classkit_method_remove</methodname>
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
<methodparam><type>string</type><parameter>methodname</parameter></methodparam>
</methodsynopsis>
<para>
Returns &true; on success, &false; on failure.
</para>
&note.classkit.selfmanipulation;
&warn.experimental.func;
</refsect1>
<refsect1>
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>classname</parameter></term>
<listitem>
<para>
The class in which to remove the method
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>methodname</parameter></term>
<listitem>
<para>
The name of the method to remove
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1>
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<!-- No changelog: it's only in PECL. -->
<refsect1>
&reftitle.examples;
<para>
<example>
<title><function>classkit_method_remove</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class Example {
function foo() {
return "foo!\n";
}
function bar() {
return "bar!\n";
}
}
// Remove the 'foo' method
classkit_method_remove(
'Example',
'foo'
);
echo implode(' ', get_class_methods('Example'));
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bar
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1>
&reftitle.seealso;
<para>
<function>classkit_method_add</function>,
<function>classkit_method_redefine</function>&listendand;
<function>classkit_method_rename</function>
</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,124 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.classkit-method-rename">
<refnamediv>
<refname>classkit_method_rename</refname>
<refpurpose>Dynamically changes the name of the given method</refpurpose>
</refnamediv>
<refsect1>
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>classkit_method_rename</methodname>
<methodparam><type>string</type><parameter>classname</parameter></methodparam>
<methodparam><type>string</type><parameter>methodname</parameter></methodparam>
<methodparam><type>string</type><parameter>newname</parameter></methodparam>
</methodsynopsis>
<para>
Returns &true; on success, &false; on failure.
</para>
&note.classkit.selfmanipulation;
&warn.experimental.func;
</refsect1>
<refsect1>
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>classname</parameter></term>
<listitem>
<para>
The class in which to rename the method
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>methodname</parameter></term>
<listitem>
<para>
The name of the method to rename
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>newname</parameter></term>
<listitem>
<para>
The new name to give to the renamed method
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1>
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<!-- No changelog: it's only in PECL. -->
<refsect1>
&reftitle.examples;
<para>
<example>
<title><function>classkit_method_rename</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class Example {
function foo() {
return "foo!\n";
}
}
// Rename the 'foo' method to 'bar'
classkit_method_rename(
'Example',
'foo',
'bar'
);
// output renamed function
echo e->bar();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
foo!
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1>
&reftitle.seealso;
<para>
<function>classkit_method_add</function>,
<function>classkit_method_remove</function>&listendand;
<function>classkit_method_redefine</function>
</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,27 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<section id="classkit.configuration">
&reftitle.runtime;
&no.config;
</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,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<reference id="ref.classkit">
<title>Classkit Functions</title>
<titleabbrev>Classkit</titleabbrev>
<partintro>
<section id="classkit.intro">
&reftitle.intro;
<para>
These functions allow the dynamic manipulation of PHP classes, at runtime.
</para>
</section>
&reference.classkit.configure;
&reference.classkit.ini;
<section id="classkit.resources">
&reftitle.resources;
&no.resource;
</section>
&reference.classkit.constants;
</partintro>
&reference.classkit.functions;
</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
-->