Reflection ReflectionProperty 클래스
(PHP 5, PHP 7, PHP 8)
소개
ReflectionProperty 클래스는 클래스 속성에 대한 정보를 보고합니다.
클래스 개요
class ReflectionProperty implements Reflector {
/* Constants */
const int IS_STATIC = 16;
const int IS_PUBLIC = 1;
const int IS_PROTECTED = 2;
const int IS_PRIVATE = 4;
/* Properties */
public string $name;
public string $class;
/* Methods */
public __construct(object|string $class, string $property)
private __clone(): void
public static export(mixed $class, string $name, bool $return = ?): string
public getAttributes(?string $name = null, int $flags = 0): array
public getDeclaringClass(): ReflectionClass
public getDefaultValue(): mixed
public getDocComment(): string|false
public getModifiers(): int
public getName(): string
public getType(): ?ReflectionType
public getValue(?object $object = null): mixed
public hasDefaultValue(): bool
public hasType(): bool
public isDefault(): bool
public isInitialized(?object $object = null): bool
public isPrivate(): bool
public isPromoted(): bool
public isProtected(): bool
public isPublic(): bool
public isReadOnly(): bool
public isStatic(): bool
public setAccessible(bool $accessible): void
public setValue(object $object, mixed $value): void
public setValue(mixed $value): void
public __toString(): string
}
Properties
- name
- 속성의 이름입니다. 읽기 전용, 쓰기 시도 시 ReflectionException이 발생합니다.
- class
- 속성이 정의된 클래스의 이름입니다. 읽기 전용, 쓰기 시도 시 ReflectionException이 발생합니다.
미리 정의된 상수
ReflectionProperty 수정자
ReflectionProperty::IS_STATIC
- static 속성을 나타냅니다. PHP 7.4.0 이전에는 값이
1
이었습니다. ReflectionProperty::IS_PUBLIC
- public 속성을 나타냅니다. PHP 7.4.0 이전에는 값이
256
이었습니다. ReflectionProperty::IS_PROTECTED
- protected 속성을 나타냅니다. PHP 7.4.0 이전에는 값이
512
였습니다. ReflectionProperty::IS_PRIVATE
- private 속성을 나타냅니다. PHP 7.4.0 이전에는 값이
1024
였습니다.
메모: 이러한 상수의 값은 PHP 버전 간에 변경될 수 있습니다. 항상 상수를 사용하고 값에 직접 의존하지 않는 것이 좋습니다.
목차
- ReflectionProperty::__clone — Clone
- ReflectionProperty::__construct — ReflectionProperty 객체 생성
- ReflectionProperty::export — 내보내다
- ReflectionProperty::getAttributes — 속성 가져오기
- ReflectionProperty::getDeclaringClass — 클래스 선언을 가져옵니다.
- ReflectionProperty::getDefaultValue — 속성에 대해 선언된 기본값을 반환합니다.
- ReflectionProperty::getDocComment — 속성 문서 주석을 가져옵니다.
- ReflectionProperty::getModifiers — 속성 수정자를 가져옵니다.
- ReflectionProperty::getName — 속성 이름 가져오기
- ReflectionProperty::getType — 속성의 유형을 가져옵니다.
- ReflectionProperty::getValue — Gets value
- ReflectionProperty::hasDefaultValue — 속성에 기본값이 선언되어 있는지 확인합니다.
- ReflectionProperty::hasType — 속성에 유형이 있는지 확인
- ReflectionProperty::isDefault — 속성이 기본 속성인지 확인
- ReflectionProperty::isInitialized — 속성이 초기화되었는지 확인합니다.
- ReflectionProperty::isPrivate — 속성이 private인지 확인
- ReflectionProperty::isPromoted — 속성이 promoted인지 확인
- ReflectionProperty::isProtected — 속성이 protected인지 확인
- ReflectionProperty::isPublic — 속성이 public인지 확인합니다.
- ReflectionProperty::isReadOnly — 속성이 읽기 전용인지 확인
- ReflectionProperty::isStatic — 속성이 static인지 확인
- ReflectionProperty::setAccessible — 속성 접근성 설정
- ReflectionProperty::setValue — 속성 값 설정
- ReflectionProperty::__toString — To string