FilterObjectProperties::from()
Not yet in a tagged release
Description
FilterObjectProperties::from() - get an object's non-static properties
// remember to import first
use GanbaroDigital\MissingBits\ClassesAndObjects\FilterObjectProperties;
// our method signature
array FilterObjectProperties::from(object $target, $propTypes = ReflectionProperty::IS_PUBLIC);
Parameters
FilterObjectProperties::from() takes two parameters:
$target(object) - the object to examine$propTypes(int) - optional scope filter
Return Values
FilterObjectProperties::from() returns an array of name / value pairs.
If the object has no non-static properties, FilterObjectProperties::from() returns an empty array.
Throws
FilterObjectProperties::from() throws an InvalidArgumentException if:
$targetis not an object
Notes
FilterObjectProperties::from()will include all non-static properties defined by the object's parents, by any traits used.FilterObjectProperties::from()only works on objects. UseFilterClassProperties::from()to get a class's static properties.