php-doc-en/reference/reflection/reflectiongenerator/gettrace.xml
2015-08-21 16:07:06 +00:00

171 lines
3.6 KiB
XML

<?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
-->