From be8a1c72de1b17b907414a813366679040933a82 Mon Sep 17 00:00:00 2001 From: Wouter van Os Date: Wed, 11 Apr 2018 13:15:24 +0200 Subject: [PATCH] Implemented check if method exists So models won't break when Acumulus updates their API's with more responses --- src/Thalent/AcumulusPhp/Parsers/Parser.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Thalent/AcumulusPhp/Parsers/Parser.php b/src/Thalent/AcumulusPhp/Parsers/Parser.php index 69419fa..eaad290 100644 --- a/src/Thalent/AcumulusPhp/Parsers/Parser.php +++ b/src/Thalent/AcumulusPhp/Parsers/Parser.php @@ -27,8 +27,11 @@ public function buildModel($item, $model) } $fieldName = 'set' . ucfirst($name); - // Call the function by the array key name - $model->$fieldName($value); + + if (method_exists($model, $fieldName)) { + // Call the function by the array key name + $model->$fieldName($value); + } }