diff --git a/library/Director/Core/RestApiResponse.php b/library/Director/Core/RestApiResponse.php index 28c17ed5..eb7b771b 100644 --- a/library/Director/Core/RestApiResponse.php +++ b/library/Director/Core/RestApiResponse.php @@ -26,9 +26,19 @@ class RestApiResponse } public function getResult($desiredKey, $filter = array()) + { + return $this->extractResult($this->results, $desiredKey, $filter); + } + + public function getSingleResult() + { + return $this->results[0]->result; + } + + protected function extractResult($results, $desiredKey, $filter = array()) { $response = array(); - foreach ($this->results as $result) { + foreach ($results as $result) { foreach ($filter as $key => $val) { if (! property_exists($result, $key)) { continue;