JsonLD icon indicating copy to clipboard operation
JsonLD copied to clipboard

Convenience methods on Node interface

Open LukasRos opened this issue 11 years ago • 1 comments

It would be nice to have some additional convenience methods on Node objects, e.g. an hasType(string $type) method that can check if the node is of a certain type and simply return true or false or an hasProperty(string $property) which can be used as a pre-check before getProperty to prevent a fatal error (calling hasValue() on a non-object).

Are you interested in accepting pull requests with helper methods like this?! If so I would fork and implement them.

LukasRos avatar Aug 10 '14 19:08 LukasRos

Yes, such helper methods (and a PR) would certainly be welcome. I’m a bit on the fence about hasProperty as checking for null is more or less the same as checking for true/false.

lanthaler avatar Aug 11 '14 13:08 lanthaler