<commit_before><?php
/**
 * Created by PhpStorm.
 * User: cwioro
 * Date: 18.06.15
 * Time: 13:38
 */

namespace bitcodin;

use bitcodin\exceptions\BitcodinException;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Message\Response;

/**
 * Class ApiResource
 * @package bitcodin
 */
abstract class ApiResource extends \stdClass
{
    /**
     * @param \stdClass $class
     */
    public function __construct(\stdClass $class)
    {
        $this->_copy($class);
    }

    /**
     * @var Client|null
     */
    private static $client = NULL;

    /**
     * @var array|null
     */
    private static $headers = NULL;

    /**
     * @return Client|null
     */
    protected function getClient()
    {
        if (self::$client === NULL)
            self::$client = new Client(['base_uri' => Bitcodin::BASE_URL]);

        return self::$client;
    }

    /**
     * @return array|null
     * @throws BitcodinException
     */
    protected function getHeaders()
    {
        if (self::$headers === NULL)
            self::$headers = ['Content-type'               => 'application/json',
                              'Accept'                     => 'application/json',
                              Bitcodin::API_KEY_FIELD_NAME => Bitcodin::getApiToken()];

        return self::$headers;
    }

    /**
     * @param $obj
     */<commit_msg>Make getClient function static<commit_after><?php
/**
 * Created by PhpStorm.
 * User: cwioro
 * Date: 18.06.15
 * Time: 13:38
 */

namespace bitcodin;

use bitcodin\exceptions\BitcodinException;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Message\Response;

/**
 * Class ApiResource
 * @package bitcodin
 */
abstract class ApiResource extends \stdClass
{
    /**
     * @param \stdClass $class
     */
    public function __construct(\stdClass $class)
    {
        $this->_copy($class);
    }

    /**
     * @var Client|null
     */
    private static $client = NULL;

    /**
     * @var array|null
     */
    private static $headers = NULL;

    /**
     * @return Client|null
     */
    protected static function getClient()
    {
        if (self::$client === NULL)
            self::$client = new Client(['base_uri' => Bitcodin::BASE_URL]);

        return self::$client;
    }

    /**
     * @return array|null
     * @throws BitcodinException
     */
    protected static function getHeaders()
    {
        if (self::$headers === NULL)
            self::$headers = ['Content-type'               => 'application/json',
                              'Accept'                     => 'application/json',
                              Bitcodin::API_KEY_FIELD_NAME => Bitcodin::getApiToken()];

        return self::$headers;
    }

    /**
     * @param $obj
     */
{'fraction_non_alphanumeric': 0.1375850949480473, 'fraction_numerical': 0.007165890361877463, 'mean_word_length': 1.9451476793248945, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4850316', 'n_tokens_mistral': 845, 'n_tokens_neox': 826, 'n_words': 173}