hgg/property-accessor

The Symfony PropertyAccessor as a trait

Installs: 418

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/hgg/property-accessor

v1.0.1 2017-09-03 18:41 UTC

This package is not auto-updated.

Last update: 2025-10-08 04:21:28 UTC


README

Provide a bit of convenience if your property access methods need to throw exceptions on an as needed basis.

Example:

$default = 'my default';
$throw   = false;
$value   = $this->getValue($obj, 'my.path.to.value', $default, $throw);

This would return the value at the given path if it exists, or the default value if not.

$default = 'my default';
$throw   = true;
$value   = $this->getValue($obj, 'my.path.to.value', $default, $throw);

This would return the value at the given path if it exists, or throw an exception if not.