<commit_before><?php

/**
 * This file is part of the Hayttp package.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2017
 * @license MIT
 */

namespace Hayttp\Traits;

/**
 * Add __debugInfo support.
 *
 * Returns ALL variables.
 */
trait HasCompleteDebugInfo
{
    /**
     * Public accessor for all instance variables.
     *
     * @return array
     */
    public function instanceVariables()
    {
        return get_object_vars($this);
    }

    /**
     * Return debug info for var_dump, et al.
     *
     * @return array
     */
    public function __debugInfo()
    {
        return array_merge(
            $this->instanceVariables(),
            method_exists($this, 'extraDebugInfo') ? $this->extraDebugInfo() : []
        );
    }
}<commit_msg>Rewrite for better static code analysis<commit_after><?php

/**
 * This file is part of the Hayttp package.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright 2017
 * @license MIT
 */

namespace Hayttp\Traits;

/**
 * Add __debugInfo support.
 *
 * Returns ALL variables.
 */
trait HasCompleteDebugInfo
{
    /**
     * Public accessor for all instance variables.
     *
     * @return array
     */
    public function instanceVariables()
    {
        return get_object_vars($this);
    }

    /**
     * Return debug info for var_dump, et al.
     *
     * @return array
     */
    public function __debugInfo()
    {
        $extraDebugFunc = [$this, 'extraDebugInfo'];
        $extraDebugInfo = is_callable($extraDebugFunc)
            ? $extraDebugFunc()
            : [];

        return array_merge(
            $this->instanceVariables(),
            $extraDebugInfo
        );
    }
}
{'fraction_non_alphanumeric': 0.12143290831815422, 'fraction_numerical': 0.004857316332726169, 'mean_word_length': 2.121212121212121, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '2346635', 'n_tokens_mistral': 492, 'n_tokens_neox': 480, 'n_words': 123}