<commit_before><?php

namespace GnuCash\Models\Book;

use GnuCash\Models\Book;

abstract class Split extends Book implements SplitInterface
{

    use SplitTrait;

    protected $table = 'splits';
    protected $primaryKey = 'guid';

    protected $fillable = [
        'reconcile_state',
        'reconcile_date',
    ];

    protected $appends = [
        'amount',
    ];

    public function account()
    {
        return $this->belongsTo($this->namespaceForBook(Account::class), 'account_guid');
    }

    public function transaction()
    {
        return $this->belongsTo($this->namespaceForBook(Transaction::class), 'tx_guid');
    }

    public function scopeForAccount($query, $accountGuid, $reconcileStates = null)
    {
        $query->where('account_guid', $accountGuid);

        if (is_array($reconcileStates)) {
            $query->whereIn('reconcile_state', $reconcileStates);
        }

        return $query;
    }

    public function scopeForTransaction($query, $txGuid)
    {
        $query->where('tx_guid', $txGuid);

        return $query;
    }

    public function scopeDuplicateMemos($query, $accountGuid)
    {
        static::scopeForAccount($query, $accountGuid);

        $query->with('transaction');

        $query->whereIn('memo', function ($query) {
            $query->select('memo')
                ->from('splits')
                ->where('memo', 'like', GNUCASH_XERO_MEMO_PREFIX . '%')
                ->groupBy('memo')
                ->havingRaw('COUNT(guid) > 1');
        });

        return $query;
    }

    public static function scopeOrphans($query, $relation)<commit_msg>Applied fixes from StyleCI<commit_after><?php

namespace GnuCash\Models\Book;

use GnuCash\Models\Book;

abstract class Split extends Book implements SplitInterface
{
    use SplitTrait;

    protected $table = 'splits';
    protected $primaryKey = 'guid';

    protected $fillable = [
        'reconcile_state',
        'reconcile_date',
    ];

    protected $appends = [
        'amount',
    ];

    public function account()
    {
        return $this->belongsTo($this->namespaceForBook(Account::class), 'account_guid');
    }

    public function transaction()
    {
        return $this->belongsTo($this->namespaceForBook(Transaction::class), 'tx_guid');
    }

    public function scopeForAccount($query, $accountGuid, $reconcileStates = null)
    {
        $query->where('account_guid', $accountGuid);

        if (is_array($reconcileStates)) {
            $query->whereIn('reconcile_state', $reconcileStates);
        }

        return $query;
    }

    public function scopeForTransaction($query, $txGuid)
    {
        $query->where('tx_guid', $txGuid);

        return $query;
    }

    public function scopeDuplicateMemos($query, $accountGuid)
    {
        static::scopeForAccount($query, $accountGuid);

        $query->with('transaction');

        $query->whereIn('memo', function ($query) {
            $query->select('memo')
                ->from('splits')
                ->where('memo', 'like', GNUCASH_XERO_MEMO_PREFIX.'%')
                ->groupBy('memo')
                ->havingRaw('COUNT(guid) > 1');
        });

        return $query;
    }

    public static function scopeOrphans($query, $relation)
{'fraction_non_alphanumeric': 0.13943488943488944, 'fraction_numerical': 0.0006142506142506142, 'mean_word_length': 2.5517993456924755, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '67648', 'n_tokens_mistral': 992, 'n_tokens_neox': 937, 'n_words': 174}