mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-23 22:52:12 +01:00
Tradução em reference/spl/recursivefilteriterator (#539)
* inclusão de arquivos originais com revisão atualizada * tradução em recursivefilteriterator
This commit is contained in:
154
reference/spl/recursivefilteriterator/construct.xml
Normal file
154
reference/spl/recursivefilteriterator/construct.xml
Normal file
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: d51166ca16fda8e766849505b84f9306ef443f71 Maintainer: fernandowobeto Status: ready --><!-- CREDITS: fernandowobeto -->
|
||||
<refentry xml:id="recursivefilteriterator.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>RecursiveFilterIterator::__construct</refname>
|
||||
<refpurpose>Cria um RecursiveFilterIterator a partir de um RecursiveIterator</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<constructorsynopsis role="RecursiveFilterIterator">
|
||||
<modifier>public</modifier> <methodname>RecursiveFilterIterator::__construct</methodname>
|
||||
<methodparam><type>RecursiveIterator</type><parameter>iterator</parameter></methodparam>
|
||||
</constructorsynopsis>
|
||||
<para>
|
||||
Cria um <classname>RecursiveFilterIterator</classname> a partir de um <classname>RecursiveIterator</classname>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>iterator</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
O <classname>RecursiveIterator</classname> a ser filtrado.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Exemplo básico de <methodname>RecursiveFilterIterator</methodname></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class TestsOnlyFilter extends RecursiveFilterIterator {
|
||||
public function accept() {
|
||||
// Aceita o item atual se pudermos percorrer ele
|
||||
// ou é um valor começando com "test"
|
||||
return $this->hasChildren() || (strpos($this->current(), "test") !== FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
$array = array("test1", array("taste2", "test3", "test4"), "test5");
|
||||
$iterator = new RecursiveArrayIterator($array);
|
||||
$filter = new TestsOnlyFilter($iterator);
|
||||
|
||||
foreach(new RecursiveIteratorIterator($filter) as $key => $value)
|
||||
{
|
||||
echo $value . "\n";
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
test1
|
||||
test3
|
||||
test4
|
||||
test5
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Exemplo de <methodname>RecursiveFilterIterator</methodname></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class StartsWithFilter extends RecursiveFilterIterator {
|
||||
|
||||
protected $word;
|
||||
|
||||
public function __construct(RecursiveIterator $rit, $word) {
|
||||
$this->word = $word;
|
||||
parent::__construct($rit);
|
||||
}
|
||||
|
||||
public function accept() {
|
||||
return $this->hasChildren() OR strpos($this->current(), $this->word) === 0;
|
||||
}
|
||||
|
||||
public function getChildren() {
|
||||
return new self($this->getInnerIterator()->getChildren(), $this->word);
|
||||
}
|
||||
}
|
||||
|
||||
$array = array("test1", array("taste2", "test3", "test4"), "test5");
|
||||
$iterator = new RecursiveArrayIterator($array);
|
||||
$filter = new StartsWithFilter($iterator, "test");
|
||||
|
||||
foreach(new RecursiveIteratorIterator($filter) as $key => $value)
|
||||
{
|
||||
echo $value . "\n";
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
test1
|
||||
test3
|
||||
test4
|
||||
test5
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>RecursiveFilterIterator::getChildren</methodname></member>
|
||||
<member><methodname>RecursiveFilterIterator::hasChildren</methodname></member>
|
||||
<member><methodname>FilterIterator::accept</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
|
||||
-->
|
||||
62
reference/spl/recursivefilteriterator/getchildren.xml
Normal file
62
reference/spl/recursivefilteriterator/getchildren.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: d51166ca16fda8e766849505b84f9306ef443f71 Maintainer: fernandowobeto Status: ready --><!-- CREDITS: fernandowobeto -->
|
||||
<refentry xml:id="recursivefilteriterator.getchildren" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>RecursiveFilterIterator::getChildren</refname>
|
||||
<refpurpose>Retorna os filhos do iterador interno contidos em um RecursiveFilterIterator</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis role="RecursiveFilterIterator">
|
||||
<modifier>public</modifier> <type class="union"><type>RecursiveFilterIterator</type><type>null</type></type><methodname>RecursiveFilterIterator::getChildren</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retorna os filhos do iterador interno contidos em um <classname>RecursiveFilterIterator</classname>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna um <classname>RecursiveFilterIterator</classname> contendo os filhos do iterador interno.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>RecursiveFilterIterator::hasChildren</methodname></member>
|
||||
<member><methodname>RecursiveIterator::getChildren</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
|
||||
-->
|
||||
63
reference/spl/recursivefilteriterator/haschildren.xml
Normal file
63
reference/spl/recursivefilteriterator/haschildren.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: d51166ca16fda8e766849505b84f9306ef443f71 Maintainer: fernandowobeto Status: ready --><!-- CREDITS: fernandowobeto -->
|
||||
<refentry xml:id="recursivefilteriterator.haschildren" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>RecursiveFilterIterator::hasChildren</refname>
|
||||
<refpurpose>Verifica se o elemento atual do iterador interno tem filhos</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis role="RecursiveFilterIterator">
|
||||
<modifier>public</modifier> <type>bool</type><methodname>RecursiveFilterIterator::hasChildren</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Verifica se o elemento atual do iterador interno tem filhos.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; se o iterador interno tiver filhos, caso contrário &false;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>RecursiveFilterIterator::getChildren</methodname></member>
|
||||
<member><methodname>RecursiveIterator::hasChildren</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
|
||||
-->
|
||||
Reference in New Issue
Block a user