mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-23 22:52:12 +01:00
134 lines
3.2 KiB
XML
134 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 42bd1bfed391b287e55e47fed1b8f8d22a033ee0 Maintainer: fernandowobeto Status: ready --><!-- CREDITS: fernandowobeto -->
|
|
<refentry xml:id="function.class-uses" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>class_uses</refname>
|
|
<refpurpose>
|
|
Retorna os traits usados pela classe fornecida
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>array</type><type>false</type></type><methodname>class_uses</methodname>
|
|
<methodparam><type class="union"><type>object</type><type>string</type></type><parameter>object_or_class</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter><initializer>&true;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Esta função retorna um array com os nomes dos traits que a
|
|
<parameter>object_or_class</parameter> fornecida usa. No entanto, isso não inclui
|
|
quaisquer traits usados por uma classe pai.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>object_or_class</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Um objeto (instância de classe) ou uma string (nome da classe).
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>autoload</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Se deve <link linkend="language.oop5.autoload">autoload</link>
|
|
caso ainda não tenha sido carregado.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Um array em caso de sucesso, ou &false; quando a classe fornecida não existe.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemplo de <function>class_uses</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
trait foo { }
|
|
class bar {
|
|
use foo;
|
|
}
|
|
|
|
print_r(class_uses(new bar));
|
|
|
|
print_r(class_uses('bar'));
|
|
|
|
spl_autoload_register();
|
|
|
|
// usando autocarregametno para carregar a classe 'not_loaded'
|
|
print_r(class_uses('not_loaded', true));
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[foo] => foo
|
|
)
|
|
Array
|
|
(
|
|
[foo] => foo
|
|
)
|
|
Array
|
|
(
|
|
[trait_of_not_loaded] => trait_of_not_loaded
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>class_parents</function></member>
|
|
<member><function>get_declared_traits</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
|
|
-->
|