ReflectionObject Sınıfı

(PHP 5, PHP 7)

Giriş

ReflectionObject sınıfı bir nesne (object) hakkında bigi edinilmesini sağlar.

Sınıf Sözdizimi

ReflectionObject extends ReflectionClass implements Reflector {
/* Sabitler */
const integer IS_IMPLICIT_ABSTRACT = 16 ;
const integer IS_EXPLICIT_ABSTRACT = 32 ;
const integer IS_FINAL = 64 ;
/* >Özellikler */
/* Yöntemler */
__construct ( object $değiştirge )
public static string export ( string $değiştirge [, bool $ihracet ] )
/* Miras alınan yöntemler */
ReflectionClass::__construct ( string $değiştirge )
public static string ReflectionClass::export ( mixed $değiştirge [, bool $ihracet = false ] )
public mixed ReflectionClass::getConstant ( string $isim )
public array ReflectionClass::getConstants ( void )
public object ReflectionClass::getConstructor ( void )
public string ReflectionClass::getDocComment ( void )
public int ReflectionClass::getEndLine ( void )
public ReflectionExtension ReflectionClass::getExtension ( void )
public string ReflectionClass::getExtensionName ( void )
public string ReflectionClass::getFileName ( void )
public array ReflectionClass::getInterfaceNames ( void )
public array ReflectionClass::getInterfaces ( void )
public object ReflectionClass::getMethod ( string $isim )
public array ReflectionClass::getMethods ([ string $süzgeç ] )
public int ReflectionClass::getModifiers ( void )
public string ReflectionClass::getName ( void )
public string ReflectionClass::getNamespaceName ( void )
public object ReflectionClass::getParentClass ( void )
public array ReflectionClass::getProperties ([ int $süzgeç ] )
public ReflectionProperty ReflectionClass::getProperty ( string $isim )
public ReflectionClassConstant ReflectionClass::getReflectionConstant ( string $name )
public string ReflectionClass::getShortName ( void )
public int ReflectionClass::getStartLine ( void )
public mixed ReflectionClass::getStaticPropertyValue ( string $isim [, string $öntanımlı ] )
public array ReflectionClass::getTraitAliases ( void )
public array ReflectionClass::getTraitNames ( void )
public array ReflectionClass::getTraits ( void )
public bool ReflectionClass::hasConstant ( string $isim )
public bool ReflectionClass::hasMethod ( string $isim )
public bool ReflectionClass::hasProperty ( string $isim )
public bool ReflectionClass::implementsInterface ( string $arayüz )
public bool ReflectionClass::inNamespace ( void )
public bool ReflectionClass::isAbstract ( void )
public bool ReflectionClass::isAnonymous ( void )
public bool ReflectionClass::isCloneable ( void )
public bool ReflectionClass::isFinal ( void )
public bool ReflectionClass::isInstance ( string $nesne )
public bool ReflectionClass::isInstantiable ( void )
public bool ReflectionClass::isInterface ( void )
public bool ReflectionClass::isInternal ( void )
public bool ReflectionClass::isIterateable ( void )
public bool ReflectionClass::isSubclassOf ( string $sınıf )
public bool ReflectionClass::isTrait ( void )
public bool ReflectionClass::isUserDefined ( void )
public object ReflectionClass::newInstance ( mixed $değiştirgeler [, mixed $... ] )
public object ReflectionClass::newInstanceArgs ([ array $değiştirgeler ] )
public void ReflectionClass::setStaticPropertyValue ( string $isim , string $değer )
public string ReflectionClass::__toString ( void )
}

Özellikler

name

Nesnenin sınıf ismi. Salt-okunur olup, bir yazma çabası ReflectionException istisnasına yol açar.

İçindekiler

add a note add a note

User Contributed Notes 2 notes

up
3
marcel dot nolte at noltecomputer dot de
8 years ago
To simply enlist all methods and properties of an object simply write:

<?php ReflectionObject::export($yourObject); ?>

,which will cause an var_export-like output.
up
-10
kuldipem at gmail dot com
2 years ago
class a {
    const abc = 1;
    public function __get($key){
        $r = new ReflectionObject($this);
        if($r->hasConstant($key)){ return $r->getConstant($key); }
    }
}
class b {
    public function getA(){
        return new a();
    }
}
$b = new b();
var_dump($b->getA()::abc);
var_dump($b->getA()::def);
To Top