mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Document ReflectionGenerator class and methods
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@337577 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
f581e88c2a
commit
921933ce5b
8 changed files with 850 additions and 0 deletions
67
reference/reflection/reflectiongenerator.xml
Normal file
67
reference/reflection/reflectiongenerator.xml
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<phpdoc:classref xml:id="class.reflectiongenerator" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>The ReflectionGenerator class</title>
|
||||
<titleabbrev>ReflectionGenerator</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
|
||||
<!-- {{{ ReflectionGenerator intro -->
|
||||
<section xml:id="reflectiongenerator.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
The <classname>ReflectionGenerator</classname> class reports
|
||||
information about a generator.
|
||||
</para>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
<section xml:id="reflectiongenerator.synopsis">
|
||||
&reftitle.classsynopsis;
|
||||
|
||||
<!-- {{{ Synopsis -->
|
||||
<classsynopsis>
|
||||
<ooclass><classname>ReflectionGenerator</classname></ooclass>
|
||||
|
||||
<!-- {{{ Class synopsis -->
|
||||
<classsynopsisinfo>
|
||||
<ooclass>
|
||||
<classname>ReflectionGenerator</classname>
|
||||
</ooclass>
|
||||
</classsynopsisinfo>
|
||||
<!-- }}} -->
|
||||
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.reflectiongenerator')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
|
||||
|
||||
</classsynopsis>
|
||||
<!-- }}} -->
|
||||
</section>
|
||||
|
||||
</partintro>
|
||||
|
||||
&reference.reflection.entities.reflectiongenerator;
|
||||
|
||||
</phpdoc:classref>
|
||||
|
||||
<!-- 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
|
||||
-->
|
113
reference/reflection/reflectiongenerator/construct.xml
Normal file
113
reference/reflection/reflectiongenerator/construct.xml
Normal file
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="reflectiongenerator.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ReflectionGenerator::__construct</refname>
|
||||
<refpurpose>Constructs a ReflectionGenerator object</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <methodname>ReflectionGenerator::__construct</methodname>
|
||||
<methodparam><type>Generator</type><parameter>generator</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Constructs a <classname>ReflectionGenerator</classname> object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>generator</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A generator object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.void;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><methodname>ReflectionGenerator::__construct</methodname> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
function gen()
|
||||
{
|
||||
yield 1;
|
||||
}
|
||||
|
||||
$gen = gen();
|
||||
|
||||
$reflectionGen = new ReflectionGenerator($gen);
|
||||
|
||||
echo <<< output
|
||||
{$reflectionGen->getFunction()->name}
|
||||
Line: {$reflectionGen->getExecutingLine()}
|
||||
File: {$reflectionGen->getExecutingFile()}
|
||||
output;
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
gen
|
||||
Line: 5
|
||||
File: /path/to/file/example.php
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>ReflectionGenerator::getFunction</methodname></member>
|
||||
<member><methodname>ReflectionGenerator::getExecutingLine</methodname></member>
|
||||
<member><methodname>ReflectionGenerator::getExecutingFile</methodname></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:"~/.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
|
||||
-->
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="reflectiongenerator.getexecutingfile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ReflectionGenerator::getExecutingFile</refname>
|
||||
<refpurpose>Gets the file name of the currently executing generator</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>string</type><methodname>ReflectionGenerator::getExecutingFile</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Get the full path and file name of the currently executing generator.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the full path and file name of the currently executing generator.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><methodname>ReflectionGenerator::getExecutingFile</methodname> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class GenExample
|
||||
{
|
||||
public function gen()
|
||||
{
|
||||
yield 1;
|
||||
}
|
||||
}
|
||||
|
||||
$gen = (new GenExample)->gen();
|
||||
|
||||
$reflectionGen = new ReflectionGenerator($gen);
|
||||
|
||||
echo "File: {$reflectionGen->getExecutingFile()}";
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
File: /path/to/file/example.php
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>ReflectionGenerator::getExecutingLine</methodname></member>
|
||||
<member><methodname>ReflectionGenerator::getExecutingGenerator</methodname></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:"~/.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
|
||||
-->
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="reflectiongenerator.getexecutinggenerator" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ReflectionGenerator::getExecutingGenerator</refname>
|
||||
<refpurpose>Gets the executing <classname>Generator</classname> object</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>Generator</type><methodname>ReflectionGenerator::getExecutingGenerator</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Get the executing <classname>Generator</classname> object
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the currently executing <classname>Generator</classname> object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><methodname>ReflectionGenerator::getExecutingGenerator</methodname> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class GenExample
|
||||
{
|
||||
public function gen()
|
||||
{
|
||||
yield 1;
|
||||
}
|
||||
}
|
||||
|
||||
$gen = (new GenExample)->gen();
|
||||
|
||||
$reflectionGen = new ReflectionGenerator($gen);
|
||||
|
||||
$gen2 = $reflectionGen->getExecutingGenerator();
|
||||
|
||||
var_dump($gen2 === $gen);
|
||||
var_dump($gen2->current());
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(true)
|
||||
int(1);
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>ReflectionGenerator::getExecutingLine</methodname></member>
|
||||
<member><methodname>ReflectionGenerator::getExecutingFile</methodname></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:"~/.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
|
||||
-->
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="reflectiongenerator.getexecutingline" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ReflectionGenerator::getExecutingLine</refname>
|
||||
<refpurpose>Gets the currently executing line of the generator</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>int</type><methodname>ReflectionGenerator::getExecutingLine</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Get the currently executing line number of the generator.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the line number of the currently executing statement in the generator.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><methodname>ReflectionGenerator::getExecutingLine</methodname> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class GenExample
|
||||
{
|
||||
public function gen()
|
||||
{
|
||||
yield 1;
|
||||
}
|
||||
}
|
||||
|
||||
$gen = (new GenExample)->gen();
|
||||
|
||||
$reflectionGen = new ReflectionGenerator($gen);
|
||||
|
||||
echo "Line: {$reflectionGen->getExecutingLine()}";
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Line: 7
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>ReflectionGenerator::getExecutingGenerator</methodname></member>
|
||||
<member><methodname>ReflectionGenerator::getExecutingFile</methodname></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:"~/.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
|
||||
-->
|
101
reference/reflection/reflectiongenerator/getfunction.xml
Normal file
101
reference/reflection/reflectiongenerator/getfunction.xml
Normal file
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="reflectiongenerator.getfunction" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ReflectionGenerator::getFunction</refname>
|
||||
<refpurpose>Gets the function name of the generator</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>ReflectionFunctionAbstract</type><methodname>ReflectionGenerator::getFunction</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Enables the function name of the generator to be obtained by returning a
|
||||
class derived from <classname>ReflectionFunctionAbstract</classname>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a <classname>ReflectionFunctionAbstract</classname> class. This will
|
||||
be <classname>ReflectionFunction</classname> for functions, or
|
||||
<classname>ReflectionMethod</classname> for methods.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><methodname>ReflectionGenerator::getFunction</methodname> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
function gen()
|
||||
{
|
||||
yield 1;
|
||||
}
|
||||
|
||||
$gen = gen();
|
||||
|
||||
$reflectionGen = new ReflectionGenerator($gen);
|
||||
|
||||
var_dump($reflectionGen->getFunction());
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
object(ReflectionFunction)#3 (1) {
|
||||
["name"]=>
|
||||
string(3) "gen"
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>ReflectionGenerator::getThis</methodname></member>
|
||||
<member><methodname>ReflectionGenerator::getTrace</methodname></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:"~/.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
|
||||
-->
|
100
reference/reflection/reflectiongenerator/getthis.xml
Normal file
100
reference/reflection/reflectiongenerator/getthis.xml
Normal file
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="reflectiongenerator.getthis" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ReflectionGenerator::getThis</refname>
|
||||
<refpurpose>Gets the <literal>$this</literal> value of the generator</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>object</type><methodname>ReflectionGenerator::getThis</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Get the <literal>$this</literal> value that the generator has access to.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the <literal>$this</literal> value, or &null; if the generator was
|
||||
not created in a class context.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><methodname>ReflectionGenerator::getThis</methodname> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class GenExample
|
||||
{
|
||||
public function gen()
|
||||
{
|
||||
yield 1;
|
||||
}
|
||||
}
|
||||
|
||||
$gen = (new GenExample)->gen();
|
||||
|
||||
$reflectionGen = new ReflectionGenerator($gen);
|
||||
|
||||
var_dump($reflectionGen->getThis());
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
object(GenExample)#3 (0) {
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>ReflectionGenerator::getFunction</methodname></member>
|
||||
<member><methodname>ReflectionGenerator::getTrace</methodname></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:"~/.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
|
||||
-->
|
171
reference/reflection/reflectiongenerator/gettrace.xml
Normal file
171
reference/reflection/reflectiongenerator/gettrace.xml
Normal file
|
@ -0,0 +1,171 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="reflectiongenerator.gettrace" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ReflectionGenerator::getTrace</refname>
|
||||
<refpurpose>Gets the trace of the executing generator</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>array</type><methodname>ReflectionGenerator::getTrace</methodname>
|
||||
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>DEBUG_BACKTRACE_PROVIDE_OBJECT</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Get the trace of the currently executing generator.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>options</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The value of <parameter>options</parameter> can be any of the following
|
||||
the following flags.
|
||||
</para>
|
||||
<para>
|
||||
<table>
|
||||
<title>Available options</title>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Option</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>
|
||||
<constant>DEBUG_BACKTRACE_PROVIDE_OBJECT</constant>
|
||||
</entry>
|
||||
<entry>
|
||||
Default.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<constant>DEBUG_BACKTRACE_IGNORE_ARGS</constant>
|
||||
</entry>
|
||||
<entry>
|
||||
Don't include the argument information for functions in the stack
|
||||
trace.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the trace of the currently executing generator.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><methodname>ReflectionGenerator::getTrace</methodname> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
function foo() {
|
||||
yield 1;
|
||||
}
|
||||
|
||||
function bar()
|
||||
{
|
||||
yield from foo();
|
||||
}
|
||||
|
||||
function baz()
|
||||
{
|
||||
yield from bar();
|
||||
}
|
||||
|
||||
$gen = baz();
|
||||
$gen->valid(); // start the generator
|
||||
|
||||
var_dump((new ReflectionGenerator($gen))->getTrace());
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(4) {
|
||||
["file"]=>
|
||||
string(18) "example.php"
|
||||
["line"]=>
|
||||
int(8)
|
||||
["function"]=>
|
||||
string(3) "foo"
|
||||
["args"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
array(4) {
|
||||
["file"]=>
|
||||
string(18) "example.php"
|
||||
["line"]=>
|
||||
int(12)
|
||||
["function"]=>
|
||||
string(3) "bar"
|
||||
["args"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>ReflectionGenerator::getFunction</methodname></member>
|
||||
<member><methodname>ReflectionGenerator::getThis</methodname></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:"~/.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
|
||||
-->
|
Loading…
Reference in a new issue