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