mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-24 08:52:09 +01:00
134 lines
3.7 KiB
XML
134 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: fd65805e83f7dc3b12ab5844cafc4489dc367a27 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes Maintainer: pmartin -->
|
|
<refentry xml:id="function.is-a" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>is_a</refname>
|
|
<refpurpose>Vérifie si l'objet est d'un certain type ou sous-type.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>is_a</methodname>
|
|
<methodparam><type>mixed</type><parameter>object_or_class</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>class</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>allow_string</parameter><initializer>&false;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Détermine si l'<parameter>object_or_class</parameter> donné est du
|
|
type d'objet <parameter>classe</parameter>,
|
|
ou a <parameter>classe</parameter> comme l'un de ses supertypes.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>object_or_class</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Un nom de classe ou une instance d'un objet.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>class</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le nom de la classe ou de l'interface.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>allow_string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si ce paramètre vaut &false;, le nom de la classe sous forme de chaîne de caractères
|
|
dans le paramètre <parameter>object_or_class</parameter> n'est pas autorisé. Ceci permet
|
|
d'éviter l'appel de l'autoloader si la classe n'existe pas.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne &true; si <parameter>object_or_class</parameter> est du
|
|
type d'objet <parameter>classe</parameter>,
|
|
ou a <parameter>classe</parameter> comme l'un de ses supertypes, &false; sinon.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>is_a</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// Définit une classe
|
|
class WidgetFactory
|
|
{
|
|
var $oink = 'moo';
|
|
}
|
|
|
|
// Crée un nouvel objet
|
|
$WF = new WidgetFactory();
|
|
|
|
if (is_a($WF, 'WidgetFactory')) {
|
|
echo "oui, \$WF est toujours un objet WidgetFactory\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Utilisation de l'opérateur <emphasis>instanceof</emphasis></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
if ($WF instanceof WidgetFactory) {
|
|
echo 'Oui, $WF est un WidgetFactory';
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>get_class</function></member>
|
|
<member><function>get_parent_class</function></member>
|
|
<member><function>is_subclass_of</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
|
|
-->
|