Files
archived-doc-pt-br/reference/intl/resourcebundle/get.xml
Leonardo Lara Rodrigues 4433356aa3 sync with en rev
2026-03-23 08:25:23 -03:00

179 lines
5.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: f7f861700c504afc40c14603d0fa0b36629a87ff Maintainer: leonardolara Status: ready --><!-- CREDITS: ae, leonardolara -->
<refentry xml:id="resourcebundle.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ResourceBundle::get</refname>
<refname>resourcebundle_get</refname>
<refpurpose>Obtém os dados do pacote</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
&style.oop;
</para>
<methodsynopsis role="ResourceBundle">
<modifier>public</modifier> <type class="union"><type>ResourceBundle</type><type>array</type><type>string</type><type>int</type><type>null</type></type><methodname>ResourceBundle::get</methodname>
<methodparam><type class="union"><type>string</type><type>int</type></type><parameter>index</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>fallback</parameter><initializer>&true;</initializer></methodparam>
</methodsynopsis>
<para>
&style.procedural;
</para>
<methodsynopsis>
<type class="union"><type>ResourceBundle</type><type>array</type><type>string</type><type>int</type><type>null</type></type><methodname>resourcebundle_get</methodname>
<methodparam><type>ResourceBundle</type><parameter>bundle</parameter></methodparam>
<methodparam><type class="union"><type>string</type><type>int</type></type><parameter>index</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>fallback</parameter><initializer>&true;</initializer></methodparam>
</methodsynopsis>
<para>
Obtém os dados do pacote através de um índice ou de uma string chave.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>bundle</parameter></term>
<listitem>
<para>
Um objeto <classname>ResourceBundle</classname>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>index</parameter></term>
<listitem>
<para>
O índice onde os dados estão. Pode ser uma string ou um intero.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>fallback</parameter></term>
<listitem>
<para>
O locale alternativo no caso de não encontrar o item exato ou outra alternativa.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Retorna os dados localizados no índice informado ou &null; caso haja erro. Strings, inteiros e dados em binário
são retornados como seus tipo correspondentes em PHP. Um array de inteiros é retornado como um array PHP.
Tipos complexos são retornados como objetos <classname>ResourceBundle</classname>.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<simpara>
Uma exceção <exceptionname>TypeError</exceptionname> é lançada se
o tipo do índice for inválido.
</simpara>
<simpara>
Uma exceção <exceptionname>ValueError</exceptionname> é lançada se
<parameter>index</parameter> for uma <type>string</type>
e estiver vazia ou se for um <type>int</type> e não
couber em um tipo inteiro de 32 bits.
</simpara>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
<simpara>
Uma exceção <exceptionname>TypeError</exceptionname> é lançada se
o tipo do índice for inválido.
Uma exceção <exceptionname>ValueError</exceptionname> é lançada se
<parameter>index</parameter> for uma <type>string</type>
e estiver vazia ou se for um <type>int</type> e não
couber em um tipo inteiro de 32 bits.
</simpara>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Exemplo da função <function>resourcebundle_get</function></title>
<programlisting role="php">
<![CDATA[
<?php
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
echo resourcebundle_get($r, 'somestring');
?>
]]>
</programlisting>
</example>
<example>
<title>Exemplo orientado à objeto</title>
<programlisting role="php">
<![CDATA[
<?php
$r = new ResourceBundle( 'es', "/usr/share/data/myapp");
echo $r->get('somestring');
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
?Hola, mundo!
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>resourcebundle_count</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:"~/.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
-->