<commit_before><?php
namespace LazyRecord\Schema\Comparator;
use Closure;
use LazyRecord\Schema\SchemaInterface;
use LazyRecord\Schema\ColumnAccessorInterface;
use LazyRecord\Schema\Comparator\ColumnDiff;
use LazyRecord\Schema\Comparator\AttributeDiff;

class AttributeDiff
{
    public $name;

    public $before;

    public $after;

    public function __construct($name, $before, $after)
    {
        $this->name = $name;
        $this->before = $before;
        $this->after = $after;
    }

    public function getBeforeDescription() {
        return sprintf("- %s %s\n", $this->name, $this->serializeVar($this->before));
    }

    public function getAfterDescription() {
        return sprintf("+ %s %s\n", $this->name, $this->serializeVar($this->after));
    }

    public function serializeVar($var) {
        if (is_object($var)) {
            return get_class($var);
        } else if (is_array($var)) {
            return join(', ', $var);
        }
        return $var;
    }
}
<commit_msg>use var_export to show deflated value<commit_after><?php
namespace LazyRecord\Schema\Comparator;
use Closure;
use LazyRecord\Schema\SchemaInterface;
use LazyRecord\Schema\ColumnAccessorInterface;
use LazyRecord\Schema\Comparator\ColumnDiff;
use LazyRecord\Schema\Comparator\AttributeDiff;

class AttributeDiff
{
    public $name;

    public $before;

    public $after;

    public function __construct($name, $before, $after)
    {
        $this->name = $name;
        $this->before = $before;
        $this->after = $after;
    }

    public function getBeforeDescription() {
        return sprintf("- %s %s\n", $this->name, $this->serializeVar($this->before));
    }

    public function getAfterDescription() {
        return sprintf("+ %s %s\n", $this->name, $this->serializeVar($this->after));
    }

    public function serializeVar($var) {
        if (is_object($var)) {
            return get_class($var);
        } else if (is_array($var)) {
            return join(', ', $var);
        } else {
            return var_export($var, true);
        }
        return $var;
    }
}

{'fraction_non_alphanumeric': 0.1399235912129895, 'fraction_numerical': 0.0, 'mean_word_length': 2.822992700729927, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '5622738', 'n_tokens_mistral': 634, 'n_tokens_neox': 632, 'n_words': 139}