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 export ( string $değiştirge [, bool $ihracet ] ) : string
/* Miras alınan yöntemler */
ReflectionClass::__construct ( string $değiştirge )
public static ReflectionClass::export ( mixed $değiştirge [, bool $ihracet = false ] ) : string
public ReflectionClass::getConstant ( string $isim ) : mixed
public ReflectionClass::getConstants ( void ) : array
public ReflectionClass::getConstructor ( void ) : object
public ReflectionClass::getDefaultProperties ( void ) : array
public ReflectionClass::getDocComment ( void ) : string
public ReflectionClass::getEndLine ( void ) : int
public ReflectionClass::getExtensionName ( void ) : string
public ReflectionClass::getFileName ( void ) : string
public ReflectionClass::getInterfaceNames ( void ) : array
public ReflectionClass::getInterfaces ( void ) : array
public ReflectionClass::getMethod ( string $isim ) : object
public ReflectionClass::getMethods ([ string $süzgeç ] ) : array
public ReflectionClass::getModifiers ( void ) : int
public ReflectionClass::getName ( void ) : string
public ReflectionClass::getNamespaceName ( void ) : string
public ReflectionClass::getParentClass ( void ) : object
public ReflectionClass::getProperties ([ int $süzgeç ] ) : array
public ReflectionClass::getReflectionConstant ( string $name ) : ReflectionClassConstant
public ReflectionClass::getShortName ( void ) : string
public ReflectionClass::getStartLine ( void ) : int
public ReflectionClass::getStaticProperties ( void ) : array
public ReflectionClass::getStaticPropertyValue ( string $isim [, string $öntanımlı ] ) : mixed
public ReflectionClass::getTraitAliases ( void ) : array
public ReflectionClass::getTraitNames ( void ) : array
public ReflectionClass::getTraits ( void ) : array
public ReflectionClass::hasConstant ( string $isim ) : bool
public ReflectionClass::hasMethod ( string $isim ) : bool
public ReflectionClass::hasProperty ( string $isim ) : bool
public ReflectionClass::implementsInterface ( string $arayüz ) : bool
public ReflectionClass::inNamespace ( void ) : bool
public ReflectionClass::isAbstract ( void ) : bool
public ReflectionClass::isAnonymous ( void ) : bool
public ReflectionClass::isCloneable ( void ) : bool
public ReflectionClass::isFinal ( void ) : bool
public ReflectionClass::isInstance ( string $nesne ) : bool
public ReflectionClass::isInstantiable ( void ) : bool
public ReflectionClass::isInterface ( void ) : bool
public ReflectionClass::isInternal ( void ) : bool
public ReflectionClass::isIterable ( void ) : bool
public ReflectionClass::isIterateable ( void ) : bool
public ReflectionClass::isSubclassOf ( string $sınıf ) : bool
public ReflectionClass::isTrait ( void ) : bool
public ReflectionClass::isUserDefined ( void ) : bool
public ReflectionClass::newInstance ( mixed $değiştirgeler [, mixed $... ] ) : object
public ReflectionClass::newInstanceArgs ([ array $değiştirgeler ] ) : object
public ReflectionClass::setStaticPropertyValue ( string $isim , string $değer ) : void
public ReflectionClass::__toString ( void ) : string
}

Ö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
8
marcel dot nolte at noltecomputer dot de
9 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
-13
kuldipem at gmail dot com
3 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