Code smells and bugs resolve 11
continuous-integration/drone/push Build is passing Details

master
Alexis 2 years ago
parent 966e961c1b
commit 85fac9b09e

@ -49,7 +49,7 @@ class ModelAdmin
if (validate::type($type)) { if (validate::type($type)) {
$question = new $type(0, $questionContent); $question = new $type(0, $questionContent);
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm'); $res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm');
if ($res->getStatusCode()!=200){ if ($res->getStatusCode() != 200){
throw new Exception('GetForm failed'); throw new Exception('GetForm failed');
} }
$form = json_decode($res->getBody()); $form = json_decode($res->getBody());
@ -130,7 +130,7 @@ class ModelAdmin
if ($res->getStatusCode() != 200) { if ($res->getStatusCode() != 200) {
throw new Exception('InsertResponseInQuestion failed'); throw new Exception('InsertResponseInQuestion failed');
} }
} catch (GuzzleException | ClientException $g){ } catch (GuzzleException | ClientException $g) {
echo "Error : " . $g->getMessage(); echo "Error : " . $g->getMessage();
throw new Exception($g->getMessage(), $g->getCode(), $g); throw new Exception($g->getMessage(), $g->getCode(), $g);
} }
@ -167,7 +167,7 @@ class ModelAdmin
{ {
try { try {
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm'); $res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm');
if ($res->getStatusCode()!=200){ if ($res->getStatusCode() != 200) {
throw new Exception('GetForm failed'); throw new Exception('GetForm failed');
} }
$formulaire = json_decode($res->getBody()); $formulaire = json_decode($res->getBody());
@ -207,7 +207,7 @@ class ModelAdmin
if ($res->getStatusCode() != 200) { if ($res->getStatusCode() != 200) {
throw new Exception('InsertKeyword failed'); throw new Exception('InsertKeyword failed');
} }
} catch (GuzzleException | ClientException $g){ } catch (GuzzleException | ClientException $g) {
echo "Error : " . $g->getMessage(); echo "Error : " . $g->getMessage();
throw new Exception($g->getMessage(), $g->getCode(), $g); throw new Exception($g->getMessage(), $g->getCode(), $g);
} }
@ -228,7 +228,7 @@ class ModelAdmin
if ($res->getStatusCode() != 200) { if ($res->getStatusCode() != 200) {
throw new Exception('DeleteKeyword failed'); throw new Exception('DeleteKeyword failed');
} }
} catch (GuzzleException | ClientException $g){ } catch (GuzzleException | ClientException $g) {
echo "Error : " . $g->getMessage(); echo "Error : " . $g->getMessage();
throw new Exception($g->getMessage(), $g->getCode(), $g); throw new Exception($g->getMessage(), $g->getCode(), $g);
} }
@ -281,7 +281,8 @@ class ModelAdmin
} }
$idForm = json_decode($res->getBody())[0]->id; $idForm = json_decode($res->getBody())[0]->id;
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getAllQuestions?'. $res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getAllQuestions?'.
'idForm='.$idForm); 'idForm='.$idForm
);
if ($res->getStatusCode() != 200) { if ($res->getStatusCode() != 200) {
throw new Exception('GetAllQuestions failed'); throw new Exception('GetAllQuestions failed');
} }
@ -290,7 +291,7 @@ class ModelAdmin
} else { } else {
return array(); return array();
} }
} catch (GuzzleException | ClientException $g){ } catch (GuzzleException | ClientException $g) {
echo "Error : " . $g->getMessage(); echo "Error : " . $g->getMessage();
throw new Exception($g->getMessage(), $g->getCode(), $g); throw new Exception($g->getMessage(), $g->getCode(), $g);
} }
@ -314,14 +315,15 @@ class ModelAdmin
$results = []; $results = [];
foreach ($responsesCandidate as $response) { foreach ($responsesCandidate as $response) {
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getDetailsListResponseOfCandidate?'. $res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getDetailsListResponseOfCandidate?'.
'id='.$response->id); 'id='.$response->id
);
if ($res->getStatusCode() != 200) { if ($res->getStatusCode() != 200) {
throw new Exception('GetDetailsListResponsesOfCandidate failed'); throw new Exception('GetDetailsListResponsesOfCandidate failed');
} }
$results[] =json_decode($res->getBody()); $results[] =json_decode($res->getBody());
} }
return $results; return $results;
} catch (GuzzleException | ClientException $g){ } catch (GuzzleException | ClientException $g) {
echo "Error : " . $g->getMessage(); echo "Error : " . $g->getMessage();
throw new Exception($g->getMessage(), $g->getCode(), $g); throw new Exception($g->getMessage(), $g->getCode(), $g);
} }

Loading…
Cancel
Save