Phosphorum\Github\OAuth::send PHP Method

send() public method

public send ( $url, $parameters, string $method = 'post' ) : boolean | mixed
$url
$parameters
$method string
return boolean | mixed
    public function send($url, $parameters, $method = 'post')
    {
        try {
            $client = new HttpClient();
            $headers = ['Accept' => 'application/json'];
            switch ($method) {
                case 'post':
                    $request = $client->post($url, $headers, $parameters);
                    break;
                case 'get':
                    $request = $client->get($url, $headers, $parameters);
                    break;
                default:
                    throw new \Exception('Invalid HTTP method');
            }
            return json_decode((string) $request->send()->getBody(), true);
        } catch (\Exception $e) {
            $this->logger->error($e->getMessage());
            return false;
        }
    }