<commit_before><?php

namespace SugarAPI\SDK\Request\Abstracts;

use SugarAPI\SDK\Request\Interfaces\RequestInterface;

abstract class AbstractRequest implements RequestInterface{

    /**
     * The HTTP Request Type
     * @var string
     */
    protected static $_TYPE = '';

    /**
     * The Default Curl Options
     * @var array
     */
    protected static $_DEFAULT_OPTIONS = array(
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0,
        CURLOPT_HEADER => true,
        CURLOPT_SSL_VERIFYPEER => 0,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_FOLLOWLOCATION => 0
    );
    /**
     * The default HTTP Headers to be added to Curl Request
     * @var array
     */
    protected static $_DEFAULT_HEADERS = array(
        "Content-Type: application/json"
    );

    /**
     * The Curl Resource used to actually send data to Sugar API
     * @var - Curl Resource
     */
    protected $CurlResponse;

    /**
     * The raw response from curl_exec
     * @var - Curl Response
     */
    protected $CurlRequest;

    /**
     * List of Headers for Request
     * @var array
     */
    protected $headers = array();

    /**
     * The body of the request or payload. JSON Encoded
     * @var string
     */
    protected $body = '';

    /**
     * The URL the Request is sent to
     * @var string
     */
    protected $url = '';

    /**
     * The Request Type
     * @var
     */
    protected $type;

    public function __construct($url = null){
        $this->start();
        if (!empty($url)){
            $this->setURL($url);
        }
        $this->setType();
        foreach(static::$_DEFAULT_OPTIONS as $option => $value){
            $this->setOption($option,$value);
        }
    }

    /**
     * @inheritdoc
     */
    public function setURL($url) {
        $this->url = $url;
        $this->setOption(CURLOPT_URL,$this->url);
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function getURL() {
        return $this->url;
    }

    /**
     * @inheritdoc
     */
    public function addHeader($name, $value) {
        $token = $name.": ".$value;
        $this->headers[] = $token;
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function setHeaders(array $array = array()) {
        if (count($array)>0) {
            foreach ($array as $key => $value) {
                $this->addHeader($key, $value);
            }
        }
        $this->setOption(CURLOPT_HTTPHEADER, $this->headers);
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function getHeaders() {
        return $this->headers;
    }

    /**
     * @inheritdoc
     */
    public function setBody($body) {
        $this->body = json_encode($body);
        $this->setOption(CURLOPT_POSTFIELDS, $this->body);
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function getBody() {
        return json_decode($this->body);
    }

    /**
     * @inheritdoc
     */
    public function getCurlObject() {
        return $this->CurlRequest;
    }

    /**
     * @inheritdoc
     */
    public function setOption($option, $value) {
        curl_setopt($this->CurlRequest, $option, $value);
    }

    /**
     * @inheritdoc
     */
    public function send() {
        $this->setHeaders();
        $this->CurlResponse = curl_exec($this->CurlRequest);
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function getResponse(){
       return $this->CurlResponse;
    }

    /**
     * Set the Type on the Request
     */
    protected function setType(){
        $this->type = static::$_TYPE;
    }
<commit_msg>Scrutinizer Auto-Fixes<commit_after><?php

namespace SugarAPI\SDK\Request\Abstracts;

use SugarAPI\SDK\Request\Interfaces\RequestInterface;

abstract class AbstractRequest implements RequestInterface{

    /**
     * The HTTP Request Type
     * @var string
     */
    protected static $_TYPE = '';

    /**
     * The Default Curl Options
     * @var array
     */
    protected static $_DEFAULT_OPTIONS = array(
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0,
        CURLOPT_HEADER => true,
        CURLOPT_SSL_VERIFYPEER => 0,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_FOLLOWLOCATION => 0
    );
    /**
     * The default HTTP Headers to be added to Curl Request
     * @var array
     */
    protected static $_DEFAULT_HEADERS = array(
        "Content-Type: application/json"
    );

    /**
     * The Curl Resource used to actually send data to Sugar API
     * @var - Curl Resource
     */
    protected $CurlResponse;

    /**
     * The raw response from curl_exec
     * @var - Curl Response
     */
    protected $CurlRequest;

    /**
     * List of Headers for Request
     * @var array
     */
    protected $headers = array();

    /**
     * The body of the request or payload. JSON Encoded
     * @var string
     */
    protected $body = '';

    /**
     * The URL the Request is sent to
     * @var string
     */
    protected $url = '';

    /**
     * The Request Type
     * @var
     */
    protected $type;

    public function __construct($url = null){
        $this->start();
        if (!empty($url)){
            $this->setURL($url);
        }
        $this->setType();
        foreach(static::$_DEFAULT_OPTIONS as $option => $value){
            $this->setOption($option,$value);
        }
    }

    /**
     * @inheritdoc
     */
    public function setURL($url) {
        $this->url = $url;
        $this->setOption(CURLOPT_URL,$this->url);
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function getURL() {
        return $this->url;
    }

    /**
     * @inheritdoc
     */
    public function addHeader($name, $value) {
        $token = $name.": ".$value;
        $this->headers[] = $token;
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function setHeaders(array $array = array()) {
        if (count($array)>0) {
            foreach ($array as $key => $value) {
                $this->addHeader($key, $value);
            }
        }
        $this->setOption(CURLOPT_HTTPHEADER, $this->headers);
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function getHeaders() {
        return $this->headers;
    }

    /**
     * @inheritdoc
     */
    public function setBody($body) {
        $this->body = json_encode($body);
        $this->setOption(CURLOPT_POSTFIELDS, $this->body);
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function getBody() {
        return json_decode($this->body);
    }

    /**
     * @inheritdoc
     */
    public function getCurlObject() {
        return $this->CurlRequest;
    }

    /**
     * @inheritdoc
     */
    public function setOption($option, $value) {
        curl_setopt($this->CurlRequest, $option, $value);
    }

    /**
     * @inheritdoc
     */
    public function send() {
        $this->setHeaders();
        $this->CurlResponse = curl_exec($this->CurlRequest);
        return $this;
    }

    /**
     * @inheritdoc
     */
    public function getResponse(){
        return $this->CurlResponse;
    }

    /**
     * Set the Type on the Request
     */
    protected function setType(){
        $this->type = static::$_TYPE;
    }

{'fraction_non_alphanumeric': 0.1356790799561884, 'fraction_numerical': 0.0016429353778751369, 'mean_word_length': 1.7881679389312977, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2389141', 'n_tokens_mistral': 2245, 'n_tokens_neox': 2179, 'n_words': 491}