From c4d9137f0f93efde042263c21fa82b78dba329c5 Mon Sep 17 00:00:00 2001 From: Jasper Wissels Date: Fri, 9 Dec 2022 15:55:38 +0100 Subject: [PATCH] add findAttribute method --- src/helpers/RequestParser.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/helpers/RequestParser.php b/src/helpers/RequestParser.php index 14a8373..a4abbc3 100644 --- a/src/helpers/RequestParser.php +++ b/src/helpers/RequestParser.php @@ -293,6 +293,18 @@ public function getAttribute($attributeName) { return $this->document['data']['attributes'][$attributeName]; } + /** + * @param string $attributeName + * @return mixed|null + */ + public function findAttribute($attributeName) { + if ($this->hasAttribute($attributeName) === false) { + return null; + } + + return $this->getAttribute($attributeName); + } + /** * @param string $relationshipName * @return boolean