diff --git a/Source/API/script/Config/composer.lock b/Source/API/script/Config/composer.lock index 0340c3f..225db55 100644 --- a/Source/API/script/Config/composer.lock +++ b/Source/API/script/Config/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "74bc65c3a5caaaf1d8b2b1be7026f6de", + "content-hash": "b8d6986e2c44c0b590a755b914d29bb4", "packages": [ { "name": "fig/http-message-util", @@ -62,337 +62,6 @@ }, "time": "2020-11-24T22:02:12+00:00" }, - { - "name": "guzzlehttp/guzzle", - "version": "7.5.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.5", - "guzzlehttp/psr7": "^1.9 || ^2.4", - "php": "^7.2.5 || ^8.0", - "psr/http-client": "^1.0", - "symfony/deprecation-contracts": "^2.2 || ^3.0" - }, - "provide": { - "psr/http-client-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "ext-curl": "*", - "php-http/client-integration-tests": "^3.0", - "phpunit/phpunit": "^8.5.29 || ^9.5.23", - "psr/log": "^1.1 || ^2.0 || ^3.0" - }, - "suggest": { - "ext-curl": "Required for CURL handler support", - "ext-intl": "Required for Internationalized Domain Name (IDN) support", - "psr/log": "Required for using the Log middleware" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - }, - "branch-alias": { - "dev-master": "7.5-dev" - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "psr-18", - "psr-7", - "rest", - "web service" - ], - "support": { - "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.5.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", - "type": "tidelift" - } - ], - "time": "2022-08-28T15:39:27+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "1.5.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "b94b2807d85443f9719887892882d0329d1e2598" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", - "reference": "b94b2807d85443f9719887892882d0329d1e2598", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5-dev" - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "support": { - "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.2" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", - "type": "tidelift" - } - ], - "time": "2022-08-28T14:55:35+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "2.4.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "67c26b443f348a51926030c83481b85718457d3d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d", - "reference": "67c26b443f348a51926030c83481b85718457d3d", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "ralouphie/getallheaders": "^3.0" - }, - "provide": { - "psr/http-factory-implementation": "1.0", - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" - }, - "suggest": { - "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - }, - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "support": { - "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.3" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", - "type": "tidelift" - } - ], - "time": "2022-10-26T14:07:24+00:00" - }, { "name": "nikic/fast-route", "version": "v1.3.0", @@ -496,58 +165,6 @@ }, "time": "2021-11-05T16:47:00+00:00" }, - { - "name": "psr/http-client", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Client\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP clients", - "homepage": "https://github.com/php-fig/http-client", - "keywords": [ - "http", - "http-client", - "psr", - "psr-18" - ], - "support": { - "source": "https://github.com/php-fig/http-client/tree/master" - }, - "time": "2020-06-29T06:28:15+00:00" - }, { "name": "psr/http-factory", "version": "1.0.1", @@ -864,56 +481,6 @@ }, "time": "2019-03-08T08:55:37+00:00" }, - { - "name": "selective/basepath", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/selective-php/basepath.git", - "reference": "63961fbfcaf492bd0ae8e40653f6c3c750c2f8ad" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/selective-php/basepath/zipball/63961fbfcaf492bd0ae8e40653f6c3c750c2f8ad", - "reference": "63961fbfcaf492bd0ae8e40653f6c3c750c2f8ad", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "psr/http-server-middleware": "^1" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2", - "overtrue/phplint": "^2", - "phpstan/phpstan": "0.*", - "phpunit/phpunit": "^8 || ^9", - "slim/psr7": "^1", - "slim/slim": "^4", - "squizlabs/php_codesniffer": "^3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Selective\\BasePath\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A URL base path detector for Slim 4", - "homepage": "https://github.com/selective-php/basepath", - "keywords": [ - "basepath", - "slim", - "slim4" - ], - "support": { - "issues": "https://github.com/selective-php/basepath/issues", - "source": "https://github.com/selective-php/basepath/tree/2.1.0" - }, - "time": "2021-07-17T10:03:02+00:00" - }, { "name": "slim/psr7", "version": "dev-master", @@ -1112,73 +679,6 @@ ], "time": "2022-11-06T16:33:39+00:00" }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.3-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-11-25T10:21:52+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.27.0", diff --git a/Source/API/script/Gateway/GatewayForm.php b/Source/API/script/Gateway/GatewayForm.php index 451e14e..2424f33 100644 --- a/Source/API/script/Gateway/GatewayForm.php +++ b/Source/API/script/Gateway/GatewayForm.php @@ -30,9 +30,7 @@ class GatewayForm { $query = "SELECT * FROM Form"; $this->connection->executeQuery($query); - $result = $this->connection->getResults(); - print(json_encode($result)); - return $result; + return $this->connection->getResults(); } public function deleteForm(array $idform): void diff --git a/Source/API/script/Gateway/GatewayKeyword.php b/Source/API/script/Gateway/GatewayKeyword.php index 4631a52..4e1def3 100644 --- a/Source/API/script/Gateway/GatewayKeyword.php +++ b/Source/API/script/Gateway/GatewayKeyword.php @@ -30,12 +30,11 @@ class GatewayKeyword )); } - public function getAllKeyword(array $ignore): void + public function getAllKeyword(array $ignore): array { $query = "SELECT * FROM Keyword"; $this->connection->executeQuery($query); - $result = $this->connection->getResults(); - print(json_encode($result)); + return $this->connection->getResults(); } public function getKeywordsContentByReference(array $id): array diff --git a/Source/API/script/Gateway/GatewayListResponseOfCandidate.php b/Source/API/script/Gateway/GatewayListResponseOfCandidate.php index 49984c5..6c38a15 100644 --- a/Source/API/script/Gateway/GatewayListResponseOfCandidate.php +++ b/Source/API/script/Gateway/GatewayListResponseOfCandidate.php @@ -14,7 +14,7 @@ class GatewayListResponseOfCandidate $this->connection = connect(); } - public function getDetailsListResponsesOfCandidate(array $idListResponse): void + public function getDetailsListResponsesOfCandidate(array $idListResponse): array { $gatewayResponse = new GatewayResponse(); $gatewayKeyword = new GatewayKeyword(); @@ -33,15 +33,15 @@ class GatewayListResponseOfCandidate $tabKeywords[] = $gatewayKeyword->getKeywordsContentByReference(array($row['id'])); } - print(json_encode(array($questionList, $responses, $tabKeywords))); + return array($questionList, $responses, $tabKeywords); } - public function getAllListResponsesOfCandidate(array $ignore): void + public function getAllListResponsesOfCandidate(array $ignore): array { $query = "SELECT * FROM ListResponsesOfCandidate"; $this->connection->executeQuery($query); - print(json_encode($this->connection->getResults())); + return $this->connection->getResults(); } public function deleteListResponseOfCandidate(array $id): void diff --git a/Source/API/script/Gateway/GatewayQuestion.php b/Source/API/script/Gateway/GatewayQuestion.php index d39d868..8dcb0da 100644 --- a/Source/API/script/Gateway/GatewayQuestion.php +++ b/Source/API/script/Gateway/GatewayQuestion.php @@ -2,9 +2,6 @@ namespace Gateway; -use BusinessClassAPI\BoxQuestionAPI; -use BusinessClassAPI\QuestionAPI; -use BusinessClassAPI\TextQuestionAPI; use Config\Connection; use PDO; @@ -92,7 +89,7 @@ class GatewayQuestion )); } - public function getAllQuestions(array $idForm): void //print en json un array contenant trois qui pour chaque indice commun de ces 3 array une question, sa liste de reponse possible et sa liste de keyword associer au réponse. les deux autres sont null si c'est une textBox + public function getAllQuestions(array $idForm): array //print en json un array contenant trois qui pour chaque indice commun de ces 3 array une question, sa liste de reponse possible et sa liste de keyword associer au réponse. les deux autres sont null si c'est une textBox { $query = "SELECT * FROM Question WHERE form = :form"; $this->connection->executeQuery($query, array( @@ -127,9 +124,9 @@ class GatewayQuestion $keywordsResponses[] = null; } } - print(json_encode(array($listQuestions, $possibleResponsesContent, $keywordsResponses))); + return array($listQuestions, $possibleResponsesContent, $keywordsResponses); } - print (json_encode(array())); + return array(); } public function getQuestionContentById(array $id): string diff --git a/Source/API/script/index.php b/Source/API/script/index.php index 4eacac5..ef64870 100644 --- a/Source/API/script/index.php +++ b/Source/API/script/index.php @@ -33,13 +33,9 @@ try{ foreach ($listGateway as $gateway) // Pour chaque Gateway { if (method_exists($gateway, $method)) { - (new $gateway)->$method($parameters); // Si oui, on appelle cette fonction + $response->getBody()->write((new $gateway)->$method($parameters)); // Si oui, on appelle cette fonction } } - $response->getBody()->write("Use the method $method, with the parameters "); - foreach ($parameters as $key => $value) { - $response->getBody()->write("Key =>" . $key . ", value =>" . $value); - } return $response->withHeader('Content-type', 'application/json'); }); }catch (TypeError $t){