<commit_before><?php
namespace LazyRecord\OperationResult;

class OperationResult
{
    public $id;

    public $success;

    public $message;

    public $sql;

    public $validations;

    public $errors;

    public $args;


    /**
     * variables from SQL Query Builder
     */
    public $vars;

    public function __construct($message = null, $extra = array() )
    {
        $this->message = $message;
        foreach( $extra as $k => $v ) {
            $this->$k = $v;
        }
    }


    /**
     * returns an array contains success validations 
     */
    public function getSuccessValidations() 
    {
        $vlds = array();
        foreach( $this->validations as $k => $vld ) {
            if( true === $vld->success )
                $vlds[$k] = $vld;
        }
        return $vlds;
    }

    public function getErrorValidations() 
    {
        $vlds = array();
        foreach( $this->validations as $k => $vld ) {
            if( false === $vld->success )
                $vlds[$k] = $vld;
        }
        return $vlds;
    }
}


<commit_msg>Add __toString method to OperationResult<commit_after><?php
namespace LazyRecord\OperationResult;

class OperationResult
{
    public $id;

    public $success;

    public $message;

    public $sql;

    public $validations;

    public $errors;

    public $args;


    /**
     * variables from SQL Query Builder
     */
    public $vars;

    public function __construct($message = null, $extra = array() )
    {
        $this->message = $message;
        foreach( $extra as $k => $v ) {
            $this->$k = $v;
        }
    }


    /**
     * returns an array contains success validations 
     */
    public function getSuccessValidations() 
    {
        $vlds = array();
        foreach( $this->validations as $k => $vld ) {
            if( true === $vld->success )
                $vlds[$k] = $vld;
        }
        return $vlds;
    }

    public function getErrorValidations() 
    {
        $vlds = array();
        foreach( $this->validations as $k => $vld ) {
            if( false === $vld->success )
                $vlds[$k] = $vld;
        }
        return $vlds;
    }

    public function __toString() {
        $msg = $this->message . "\n";
        if( $this->exception ) {
            $msg .= ' Exception:' . $this->exception->getMessage() . "\n";
            if( $this->sql ) {
                $msg .= ' SQL:' . $this->sql . "\n";
            }
        }
        return $msg;
    }
}



{'fraction_non_alphanumeric': 0.1414790996784566, 'fraction_numerical': 0.0, 'mean_word_length': 1.6090146750524108, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '1784517', 'n_tokens_mistral': 792, 'n_tokens_neox': 755, 'n_words': 186}