class ReflectionMethodExtractor (View source)

Automatic method extraction logic for Reflection objects

This class automatically discovers and calls getter methods on Reflection objects, extracting all available data dynamically. This ensures forward compatibility when new methods are added to PHP's Reflection API.

PHP 5.6+ compatible

Methods

static array
extractData(object $reflectionObject, array $config = [])

Extract data from a reflection object by automatically calling all getter methods

static mixed
makeSerializable(mixed $value, int $depth = 0, int $maxDepth = 3)

Convert extracted data to serializable format Handles Reflection objects, arrays, and primitives

Details

static array extractData(object $reflectionObject, array $config = [])

Extract data from a reflection object by automatically calling all getter methods

Parameters

object $reflectionObject

The reflection object to extract data from

array $config

Configuration for extraction behavior

Return Value

array

Extracted data as associative array

static mixed makeSerializable(mixed $value, int $depth = 0, int $maxDepth = 3)

Convert extracted data to serializable format Handles Reflection objects, arrays, and primitives

Uses ReflectionTypeRegistry for centralized type-to-adapter mapping. This eliminates hardcoded type checks and makes it easier to support new Reflection types added in future PHP versions.

Parameters

mixed $value

The value to convert

int $depth

Current recursion depth

int $maxDepth

Maximum recursion depth

Return Value

mixed

Serializable value