2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 06:41:36 +00:00
|
|
|
<!-- $Revision$ -->
|
2009-06-23 16:43:53 +00:00
|
|
|
<refentry xml:id="function.class-alias" xmlns="http://docbook.org/ns/docbook">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>class_alias</refname>
|
|
|
|
<refpurpose>Creates an alias for a class</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
2011-02-11 14:16:57 +00:00
|
|
|
<type>bool</type><methodname>class_alias</methodname>
|
2012-10-08 08:25:55 +00:00
|
|
|
<methodparam><type>string</type><parameter>original</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>alias</parameter></methodparam>
|
2012-10-08 08:37:00 +00:00
|
|
|
<methodparam choice="opt"><type>bool</type><parameter>autoload</parameter><initializer>&true;</initializer></methodparam>
|
2009-06-23 16:43:53 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2009-07-17 03:58:48 +00:00
|
|
|
Creates an alias named <parameter>alias</parameter>
|
2013-10-09 06:07:52 +00:00
|
|
|
based on the user defined class <parameter>original</parameter>.
|
2009-06-23 16:43:53 +00:00
|
|
|
The aliased class is exactly the same as the original class.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>original</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The original class.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>alias</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The alias name for the class.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2012-10-08 08:25:55 +00:00
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>autoload</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Whether do autoload if the original class is not found.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2009-06-23 16:43:53 +00:00
|
|
|
</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> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
|
|
|
|
class foo { }
|
|
|
|
|
|
|
|
class_alias('foo', 'bar');
|
|
|
|
|
|
|
|
$a = new foo;
|
|
|
|
$b = new bar;
|
|
|
|
|
|
|
|
// the objects are the same
|
|
|
|
var_dump($a == $b, $a === $b);
|
|
|
|
var_dump($a instanceof $b);
|
|
|
|
|
|
|
|
// the classes are the same
|
|
|
|
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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2009-06-23 16:43:53 +00:00
|
|
|
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
|
|
|
|
-->
|