mirror of
https://github.com/php/doc-ru.git
synced 2025-07-30 12:57:40 +00:00
136 lines
3.4 KiB
XML
136 lines
3.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: c44475e1fafcbee203ed4935a6d5d7a01379fcdc Maintainer: shein Status: ready -->
|
||
<!-- Reviewed: yes -->
|
||
<refentry xml:id="function.class-alias" xmlns="http://docbook.org/ns/docbook">
|
||
<refnamediv>
|
||
<refname>class_alias</refname>
|
||
<refpurpose>Создаёт псевдоним для указанного класса</refpurpose>
|
||
</refnamediv>
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<methodsynopsis>
|
||
<type>bool</type><methodname>class_alias</methodname>
|
||
<methodparam><type>string</type><parameter>class</parameter></methodparam>
|
||
<methodparam><type>string</type><parameter>alias</parameter></methodparam>
|
||
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter><initializer>&true;</initializer></methodparam>
|
||
</methodsynopsis>
|
||
<para>
|
||
Создаёт псевдоним <parameter>alias</parameter>
|
||
для пользовательского класса <parameter>class</parameter>.
|
||
Новый класс с псевдонимом будет точно таким же,
|
||
как и оригинальный класс.
|
||
</para>
|
||
</refsect1>
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<para>
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>class</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Оригинальный класс.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>alias</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Имя псевдонима для класса.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
<varlistentry>
|
||
<term><parameter>autoload</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Нужно ли автоматически подгружать оригинальный класс, если он не был найден.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</para>
|
||
</refsect1>
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
&return.success;
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>Пример использования <function>class_alias</function></title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
class foo { }
|
||
|
||
class_alias('foo', 'bar');
|
||
|
||
$a = new foo;
|
||
$b = new bar;
|
||
|
||
// объекты одинаковы
|
||
var_dump($a == $b, $a === $b);
|
||
var_dump($a instanceof $b);
|
||
|
||
// классы одинаковы
|
||
var_dump($a instanceof foo);
|
||
var_dump($a instanceof bar);
|
||
|
||
var_dump($b instanceof foo);
|
||
var_dump($b instanceof bar);
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
&example.outputs;
|
||
<screen>
|
||
<![CDATA[
|
||
bool(true)
|
||
bool(false)
|
||
bool(true)
|
||
bool(true)
|
||
bool(true)
|
||
bool(true)
|
||
bool(true)
|
||
]]>
|
||
</screen>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
<refsect1 role="seealso">
|
||
&reftitle.seealso;
|
||
<para>
|
||
<simplelist>
|
||
<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
|
||
-->
|