public function getEvaluationModel($code) { if (empty($code)) { throw new \Exception('Unknown beneficiary\'s evaluation model with these given criteria'); } $data = null; try { // -- Find data $request = $this->client->get('evaluations/model/' . $code); $response = $request->send()->json(); // - Wrong result if (StatusConstants::OK != $response['status']) { throw new \Exception($response['message'], StatusConstants::toCode($response['status'])); } if (!array_key_exists('data', $response) || empty($response['data']) || !is_array($response['data'])) { return null; } // - Good result $data = EvaluationModel::fromJson($response['data']); } catch (\Exception $e) { throw new \Exception('Erreur lors de la recherche du modèle d\'évaluation.', StatusConstants::toCode($e->getCode()), $e); } return $data; }