Reflection
PHP Manual

Extending

اگر شما می‌خواهید نسخه تخصصی تری از کلاس داخلی بسازید ( برای ساخت HTML رنگی هنگام ارسال، متغیرهایی با دسترسی آسان بهتر از متدها یا متدهای کاربردی) شما می‌توانید آنها را گسترش دهید.

Example #2 گسترش کلاس‌های داخلی

<?php
/**
 * My Reflection_Method class
 */
class My_Reflection_Method extends ReflectionMethod
{
    public 
$visibility = array();

    public function 
__construct($o$m)
    {
        
parent::__construct($o$m);
        
$this->visibility Reflection::getModifierNames($this->getModifiers());
    }
}

/**
 * Demo class #1
 *
 */
class {
    protected function 
x() {}
}

/**
 * Demo class #2
 *
 */
class extends {
    function 
x() {}
}

// Print out information
var_dump(new My_Reflection_Method('U''x'));
?>

The above example will output something similar to:

object(My_Reflection_Method)#1 (3) {
  ["visibility"]=>
  array(1) {
    [0]=>
    string(6) "public"
  }
  ["name"]=>
  string(1) "x"
  ["class"]=>
  string(1) "U"
}
Caution

اگر سازنده را بازنویسی می‌کنید بیاد داشته باشید تا سازنده کلاس والد را ابتدا فراخوانی کنید. انجام ندادن این کار موجب مورد زیر می‌شود: Fatal error: Internal error: Failed to retrieve the reflection object


Reflection
PHP Manual