<commit_before><?php
/**
 * Created by PhpStorm.
 * User: joro
 * Date: 23.5.2017 г.
 * Time: 09:35 ч.
 */

namespace Omniship\Econt\Http;

use Omniship\Econt\Lib\Interfaces\ErrorResponseInterface;
use Omniship\Message\AbstractResponse AS BaseAbstractResponse;

class AbstractResponse extends BaseAbstractResponse
{

    protected $error;

    protected $errorCode;

    /**
     * @return null|string
     */
    public function getMessage()
    {
        if(is_string($this->data)) {
            return preg_replace('~([\s]{2,})~', ' ', str_replace(["\n\r", "\r\n", "\r", "\n"], ' ', $this->data));
        } elseif($this->data instanceof ErrorResponseInterface && ($this->data->getErrorCode() || $this->data->getError())) {
            return preg_replace('~([\s]{2,})~', ' ', str_replace(["\n\r", "\r\n", "\r", "\n"], ' ', $this->data->getError()));
        } elseif(is_string($this->error)) {
            return $this->error;
        }
        return null;
    }

    /**
     * @return null|string
     */
    public function getCode()
    {
        if(is_string($this->data)) {
            return md5($this->data);
        } elseif($this->data instanceof ErrorResponseInterface && ($this->data->getErrorCode() || $this->data->getError())) {
            return $this->data->getErrorCode() ? : md5($this->data->getError());
        } elseif(is_string($this->errorCode)) {
            return $this->errorCode;
        }
        return null;
    }

}<commit_msg>add log fore createBillOfLading<commit_after><?php
/**
 * Created by PhpStorm.
 * User: joro
 * Date: 23.5.2017 г.
 * Time: 09:35 ч.
 */

namespace Omniship\Econt\Http;

use Omniship\Econt\Lib\Interfaces\ErrorResponseInterface;
use Omniship\Message\AbstractResponse AS BaseAbstractResponse;

class AbstractResponse extends BaseAbstractResponse
{

    protected $error;

    protected $errorCode;

    protected $client;

    /**
     * @return null|string
     */
    public function getMessage()
    {
        if(is_string($this->data)) {
            return preg_replace('~([\s]{2,})~', ' ', str_replace(["\n\r", "\r\n", "\r", "\n"], ' ', $this->data));
        } elseif($this->data instanceof ErrorResponseInterface && ($this->data->getErrorCode() || $this->data->getError())) {
            return preg_replace('~([\s]{2,})~', ' ', str_replace(["\n\r", "\r\n", "\r", "\n"], ' ', $this->data->getError()));
        } elseif(is_string($this->error)) {
            return $this->error;
        }
        return null;
    }

    /**
     * @return null|string
     */
    public function getCode()
    {
        if(is_string($this->data)) {
            return md5($this->data);
        } elseif($this->data instanceof ErrorResponseInterface && ($this->data->getErrorCode() || $this->data->getError())) {
            return $this->data->getErrorCode() ? : md5($this->data->getError());
        } elseif(is_string($this->errorCode)) {
            return $this->errorCode;
        }
        return null;
    }

    /**
     * @return mixed
     */
    public function getClient()
    {
        return $this->client;
    }

    /**
     * @param mixed $client
     * @return AbstractResponse
     */
    public function setClient($client)
    {
        $this->client = $client;
        return $this;
    }

}
{'fraction_non_alphanumeric': 0.1879400061218243, 'fraction_numerical': 0.009182736455463728, 'mean_word_length': 2.4802981895633653, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '5190934', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1021, 'n_words': 182}