<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.reflectionclass.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'reflectionclass.initializelazyobject.php',
    1 => 'ReflectionClass::initializeLazyObject',
    2 => 'Forces initialization of a lazy object',
  ),
  'up' => 
  array (
    0 => 'class.reflectionclass.php',
    1 => 'ReflectionClass',
  ),
  'prev' => 
  array (
    0 => 'reflectionclass.implementsinterface.php',
    1 => 'ReflectionClass::implementsInterface',
  ),
  'next' => 
  array (
    0 => 'reflectionclass.innamespace.php',
    1 => 'ReflectionClass::inNamespace',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/reflection/reflectionclass/initializelazyobject.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="reflectionclass.initializelazyobject" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ReflectionClass::initializeLazyObject</h1>
  <p class="verinfo">(PHP 8 &gt;= 8.4.0)</p><p class="refpurpose"><span class="refname">ReflectionClass::initializeLazyObject</span> &mdash; <span class="dc-title">Forces initialization of a lazy object</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-reflectionclass.initializelazyobject-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ReflectionClass::initializeLazyObject</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.object.php" class="type object">object</a></span> <code class="parameter">$object</code></span>): <span class="type"><a href="language.types.object.php" class="type object">object</a></span></div>

  <p class="simpara">
   Forces initialization of the specified <code class="parameter">object</code>. This
   method has no effect if the object is not lazy or has already been
   initialized. Otherwise, initialization proceeds as described in the
   <a href="language.oop5.lazy-objects.php#language.oop5.lazy-objects.initialization-sequence" class="link">Initialization
   Sequence</a>.
  </p>

  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <span class="simpara">
    In most cases, calling this method is unnecessary, as lazy objects
    initialize themselves automatically when their state is observed or
    modified.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-reflectionclass.initializelazyobject-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">object</code></dt>
    <dd>
     <span class="simpara">
      The object to initialize.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-reflectionclass.initializelazyobject-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="simpara">
   If <code class="parameter">object</code> is a lazy proxy, returns its real instance.
   Otherwise, returns <code class="parameter">object</code> itself.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-reflectionclass.initializelazyobject-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 Basic usage</strong></p>
   <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">Example<br /></span><span style="color: #007700">{<br />    public function </span><span style="color: #0000BB">__construct</span><span style="color: #007700">(public </span><span style="color: #0000BB">int $prop</span><span style="color: #007700">) {<br />    }<br />}<br /><br /></span><span style="color: #0000BB">$reflector </span><span style="color: #007700">= new </span><span style="color: #0000BB">ReflectionClass</span><span style="color: #007700">(</span><span style="color: #0000BB">Example</span><span style="color: #007700">::class);<br /><br /></span><span style="color: #0000BB">$object </span><span style="color: #007700">= </span><span style="color: #0000BB">$reflector</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">newLazyGhost</span><span style="color: #007700">(function (</span><span style="color: #0000BB">$object</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"Initializer called\n"</span><span style="color: #007700">;<br />    </span><span style="color: #0000BB">$object</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">__construct</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />});<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$object</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$reflector</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">initializeLazyObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$object</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$object</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Поданий вище приклад
виведе:</p></div>
   <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">lazy ghost object(Example)#3 (0) {
  [&quot;prop&quot;]=&gt;
  uninitialized(int)
}
Initializer called
object(Example)#3 (1) {
  [&quot;prop&quot;]=&gt;
  int(1)
}</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-reflectionclass.initializelazyobject-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><a href="language.oop5.lazy-objects.php" class="link">Lazy objects</a></li>
   <li><span class="methodname"><a href="reflectionclass.newlazyghost.php" class="methodname" rel="rdfs-seeAlso">ReflectionClass::newLazyGhost()</a> - Creates a new lazy ghost instance</span></li>
   <li><span class="methodname"><a href="reflectionclass.marklazyobjectasinitialized.php" class="methodname" rel="rdfs-seeAlso">ReflectionClass::markLazyObjectAsInitialized()</a> - Marks a lazy object as initialized without calling the initializer or factory</span></li>
   <li><span class="methodname"><a href="reflectionclass.isuninitializedlazyobject.php" class="methodname" rel="rdfs-seeAlso">ReflectionClass::isUninitializedLazyObject()</a> - Checks if an object is lazy and uninitialized</span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>