pollita Sun May 1 13:33:09 2005 EDT Added files: /phpdoc/en/reference/runkit/functions runkit-method-add.xml runkit-method-copy.xml runkit-method-redefine.xml runkit-method-remove.xml runkit-method-rename.xml
Modified files: /phpdoc/en language-snippets.ent Log: Add runkit_method_*() functions and matching entity
http://cvs.php.net/diff.php/phpdoc/en/language-snippets.ent?r1=1.147&r2=1.148&ty=u Index: phpdoc/en/language-snippets.ent diff -u phpdoc/en/language-snippets.ent:1.147 phpdoc/en/language-snippets.ent:1.148 --- phpdoc/en/language-snippets.ent:1.147 Mon Apr 25 21:20:37 2005 +++ phpdoc/en/language-snippets.ent Sun May 1 13:33:08 2005 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.147 $ --> +<!-- $Revision: 1.148 $ --> <!-- Keep 'em sorted --> @@ -570,7 +570,12 @@ <!ENTITY listendand ' and'> -<!-- classkit entities --> +<!-- classkit and runkit entities --> <!ENTITY note.classkit.selfmanipulation '<note><simpara>This function cannot be used to manipulate the currently running (or chained) method.</simpara> </note>'> + +<!ENTITY note.runkit.selfmanipulation '<note><simpara>This function cannot +be used to manipulate the currently running (or chained) method.</simpara> +</note>'> + http://cvs.php.net/co.php/phpdoc/en/reference/runkit/functions/runkit-method-add.xml?r=1.1&p=1 Index: phpdoc/en/reference/runkit/functions/runkit-method-add.xml +++ phpdoc/en/reference/runkit/functions/runkit-method-add.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.runkit-method-add"> <refnamediv> <refname>runkit_method_add</refname> <refpurpose>Dynamically adds a new method to a given class</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>runkit_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> &warn.experimental.func; </refsect1> <refsect1 role="parameters"> &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>RUNKIT_ACC_PUBLIC</constant>, <constant>RUNKIT_ACC_PROTECTED</constant> or <constant>RUNKIT_ACC_PRIVATE</constant> </para> <note> <para> This parameter is only used as of PHP 5, because, prior to this, all methods were public. </para> </note> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <!-- No changelog: it's only in PECL. --> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>runkit_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 runkit_method_add( 'Example', 'add', '$num1, $num2', 'return $num1 + $num2;', RUNKIT_ACC_PUBLIC ); // add 12 + 4 echo $e->add(12, 4); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ 16 ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>runkit_method_copy</function></member> <member><function>runkit_method_redefine</function></member> <member><function>runkit_method_remove</function></member> <member><function>runkit_method_rename</function></member> <member><function>runkit_function_add</function></member> </simplelist> </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/runkit/functions/runkit-method-copy.xml?r=1.1&p=1 Index: phpdoc/en/reference/runkit/functions/runkit-method-copy.xml +++ phpdoc/en/reference/runkit/functions/runkit-method-copy.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.runkit-method-copy"> <refnamediv> <refname>runkit_method_copy</refname> <refpurpose>Copies a method from class to another</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>runkit_method_copy</methodname> <methodparam><type>string</type><parameter>dClass</parameter></methodparam> <methodparam><type>string</type><parameter>dMethod</parameter></methodparam> <methodparam><type>string</type><parameter>sClass</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>sMethod</parameter></methodparam> </methodsynopsis> &warn.experimental.func; </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>dClass</parameter></term> <listitem> <para> Destination class for copied method </para> </listitem> </varlistentry> <varlistentry> <term><parameter>dMethod</parameter></term> <listitem> <para> Destination method name </para> </listitem> </varlistentry> <varlistentry> <term><parameter>sClass</parameter></term> <listitem> <para> Source class of the method to copy </para> </listitem> </varlistentry> <varlistentry> <term><parameter>sMethod</parameter></term> <listitem> <para> Name of the method to copy from the source class. If this parameter is omitted, the value of <parameter>dMethod</parameter> is assumed. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <!-- No changelog: it's only in PECL. --> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>runkit_method_copy</function> example</title> <programlisting role="php"> <![CDATA[ <?php class Foo { function example() { return "foo!\n"; } } class Bar { // initially, no methods } // copy the example() method from the Foo class to the Bar class, as baz() runkit_method_copy('Bar', 'baz', 'Foo', 'example'); // output copied function echo Bar::baz(); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ foo! ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>runkit_method_add</function></member> <member><function>runkit_method_redefine</function></member> <member><function>runkit_method_remove</function></member> <member><function>runkit_method_rename</function></member> <member><function>runkit_function_copy</function></member> </simplelist> </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/runkit/functions/runkit-method-redefine.xml?r=1.1&p=1 Index: phpdoc/en/reference/runkit/functions/runkit-method-redefine.xml +++ phpdoc/en/reference/runkit/functions/runkit-method-redefine.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.runkit-method-redefine"> <refnamediv> <refname>runkit_method_redefine</refname> <refpurpose>Dynamically changes the code of the given method</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>runkit_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> ¬e.runkit.selfmanipulation; &warn.experimental.func; </refsect1> <refsect1 role="parameters"> &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>RUNKIT_ACC_PUBLIC</constant>, <constant>RUNKIT_ACC_PROTECTED</constant> or <constant>RUNKIT_ACC_PRIVATE</constant> </para> <note> <para> This parameter is only used as of PHP 5, because, prior to this, all methods were public. </para> </note> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <!-- No changelog: it's only in PECL. --> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>runkit_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 runkit_method_redefine( 'Example', 'foo', '', 'return "bar!\n";', RUNKIT_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 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>runkit_method_add</function></member> <member><function>runkit_method_copy</function></member> <member><function>runkit_method_remove</function></member> <member><function>runkit_method_rename</function></member> <member><function>runkit_function_redefine</function></member> </simplelist> </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/runkit/functions/runkit-method-remove.xml?r=1.1&p=1 Index: phpdoc/en/reference/runkit/functions/runkit-method-remove.xml +++ phpdoc/en/reference/runkit/functions/runkit-method-remove.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.runkit-method-remove"> <refnamediv> <refname>runkit_method_remove</refname> <refpurpose>Dynamically removes the given method</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>runkit_method_remove</methodname> <methodparam><type>string</type><parameter>classname</parameter></methodparam> <methodparam><type>string</type><parameter>methodname</parameter></methodparam> </methodsynopsis> ¬e.runkit.selfmanipulation; &warn.experimental.func; </refsect1> <refsect1 role="parameters"> &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 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <!-- No changelog: it's only in PECL. --> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>runkit_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 runkit_method_remove( 'Example', 'foo' ); echo implode(' ', get_class_methods('Example')); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ bar ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>runkit_method_add</function></member> <member><function>runkit_method_copy</function></member> <member><function>runkit_method_redefine</function></member> <member><function>runkit_method_rename</function></member> <member><function>runkit_function_remove</function></member> </simplelist> </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 --> http://cvs.php.net/co.php/phpdoc/en/reference/runkit/functions/runkit-method-rename.xml?r=1.1&p=1 Index: phpdoc/en/reference/runkit/functions/runkit-method-rename.xml +++ phpdoc/en/reference/runkit/functions/runkit-method-rename.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.runkit-method-rename"> <refnamediv> <refname>runkit_method_rename</refname> <refpurpose>Dynamically changes the name of the given method</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>runkit_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> ¬e.runkit.selfmanipulation; &warn.experimental.func; </refsect1> <refsect1 role="parameters"> &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 role="returnvalues"> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <!-- No changelog: it's only in PECL. --> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>runkit_method_rename</function> example</title> <programlisting role="php"> <![CDATA[ <?php class Example { function foo() { return "foo!\n"; } } // Rename the 'foo' method to 'bar' runkit_method_rename( 'Example', 'foo', 'bar' ); // output renamed function echo Example::bar(); ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ foo! ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>runkit_method_add</function></member> <member><function>runkit_method_copy</function></member> <member><function>runkit_method_redefine</function></member> <member><function>runkit_method_remove</function></member> <member><function>runkit_function_rename</function></member> </simplelist> </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 -->