mirror of
https://github.com/php/doc-tr.git
synced 2026-03-24 15:22:23 +01:00
172 lines
4.1 KiB
XML
172 lines
4.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: 967b4787bab600be8f96129d4960ad60f47f31e7 Maintainer: nilgun Status: ready -->
|
||
<refentry xml:id="reflectionfunction.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||
<refnamediv>
|
||
<refname>ReflectionFunction::__construct</refname>
|
||
<refpurpose>Bir <classname>ReflectionFunction</classname> nesnesi oluşturur
|
||
</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<constructorsynopsis>
|
||
<modifier>public</modifier> <methodname>ReflectionFunction::__construct</methodname>
|
||
<methodparam><type class="union"><type>Closure</type><type>string</type></type><parameter>function</parameter></methodparam>
|
||
</constructorsynopsis>
|
||
<para>
|
||
Bir <classname>ReflectionFunction</classname> nesnesi oluşturur.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<para>
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>function</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Yansıtılılacak işlevin ismi veya
|
||
bir <link linkend="functions.anonymous">anonim işlev</link>
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="errors">
|
||
&reftitle.errors;
|
||
<para>
|
||
<parameter>function</parameter> değiştirgesi geçerli bir işlev ismi içermiyorsa bir <classname>ReflectionException</classname> yavrulanır.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>- <methodname>ReflectionFunction::__construct</methodname> örneği
|
||
</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
/**
|
||
* Basit bir sayaç
|
||
*
|
||
* @return int
|
||
*/
|
||
function sayaç1()
|
||
{
|
||
static $c = 0;
|
||
return ++$c;
|
||
}
|
||
|
||
/**
|
||
* Başka bir basit sayaç
|
||
*
|
||
* @return int
|
||
*/
|
||
$sayaç2 = function()
|
||
{
|
||
static $d = 0;
|
||
return ++$d;
|
||
};
|
||
|
||
function dumpReflectionFunction($func)
|
||
{
|
||
|
||
// Temel bilgileri basalım
|
||
printf(
|
||
"===> %s '%s' işlevi\n".
|
||
" %s dosyasının\n".
|
||
" %d. satırından %d. satırına kadar tanımlanmış\n",
|
||
$func->isInternal() ? 'Yerleşik' : 'Kullanıcı tanımlı',
|
||
$func->getName(),
|
||
$func->getFileName(),
|
||
$func->getStartLine(),
|
||
$func->getEndline()
|
||
);
|
||
|
||
// Belgelendirici açıklamaları basalım
|
||
printf("---> Belgeleme:\n %s\n", var_export($func->getDocComment(), 1));
|
||
|
||
// Varsa statik değişkenleri basalım
|
||
if ($statics = $func->getStaticVariables())
|
||
{
|
||
printf("---> Statik değişkenler: %s\n", var_export($statics, 1));
|
||
}
|
||
}
|
||
|
||
// ReflectionFunction sınıfının bir örneğini oluşturalım
|
||
dumpReflectionFunction(new ReflectionFunction('sayaç1'));
|
||
dumpReflectionFunction(new ReflectionFunction($sayaç2));
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
&example.outputs.similar;
|
||
<screen>
|
||
<![CDATA[
|
||
===> Kullanıcı tanımlı 'sayaç1' işlevi
|
||
Z:\reflectcounter.php dosyasının
|
||
7. satırından 11. satırına kadar tanımlanmış
|
||
---> Belgeleme:
|
||
'/**
|
||
* Basit bir sayaç
|
||
*
|
||
* @return int
|
||
*/'
|
||
---> Statik değişkenler: array (
|
||
'c' => 0,
|
||
)
|
||
===> Kullanıcı tanımlı '{closure}' işlevi
|
||
Z:\reflectcounter.php dosyasının
|
||
18. satırından 22. satırına kadar tanımlanmış
|
||
---> Belgeleme:
|
||
'/**
|
||
* Başka bir basit sayaç
|
||
*
|
||
* @return int
|
||
*/'
|
||
---> Statik değişkenler: array (
|
||
'd' => 0,
|
||
)
|
||
]]>
|
||
</screen>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="seealso">
|
||
&reftitle.seealso;
|
||
<para>
|
||
<simplelist>
|
||
<member><methodname>ReflectionMethod::__construct</methodname></member>
|
||
<member><link linkend="language.oop5.decon.constructor">Kurucular</link></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
|
||
-->
|