Source of file JSONParsing.php
Size: 0,754 Bytes - Last Modified: 2019-08-09T18:27:54+00:00
/home/travis/build/zerospam/sdk-framework/src/Utils/JSON/JSONParsing.php
12345678910111213141516171819202122232425262728293031323334353637383940414243 | <?php /** * Created by PhpStorm. * User: aaflalo * Date: 18-06-01 * Time: 11:11. */ namespace ZEROSPAM\Framework\SDK\Utils\JSON; use Psr\Http\Message\ResponseInterface; /** * Class JSONParsing * * Parse a request JSON * * @package ZEROSPAM\Framework\SDK\Utils\JSON */ final class JSONParsing { private function __construct() { } /** * Parse the content of a response. * * @param ResponseInterface $response * * @return array */ public static function responseToJson(ResponseInterface $response) { $contents = $response->getBody()->getContents(); if (empty($contents)) { return []; } return \GuzzleHttp\json_decode($contents, true); } } |