for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Xigen;
use GuzzleHttp\Client;
class ESM
{
use Shortcuts\Banner;
use Shortcuts\Client;
use Shortcuts\Templates;
public $responseData;
public $options;
private $client;
private $response;
$response
This check marks private properties in classes that are never used. Those properties can be removed.
public function __construct($options)
$this->options = $options;
$this->client = new Client([
'base_url' => [$this->options['URL'], ['version' => 'v2']]
]);
}
public function testConnection()
$this->get('/ping');
public function getRequestData($JsonDecode = true)
if ($JsonDecode == true) {
===
When comparing two booleans, it is generally considered safer to use the strict comparison operator.
$this->responseData = $this->__toArray($this->responseData);
return $this->responseData;
public function __toArray($data)
return @json_decode($data);
private function get($endpoint)
try {
$response = $this->client->post($this->options['URL'] . $endpoint, [
'body' => [
'APIKEY' => $this->options['APIKEY']
]
$this->responseData = (string) $response->getBody();
} catch (\GuzzleHttp\Exception\RequestException $e) {
var_dump($e);
This check marks private properties in classes that are never used. Those properties can be removed.