<commit_before><?php

class Kint_Renderer_Rich extends Kint_Renderer
{
    public static $object_renderers = array(
        'callable' => 'Kint_Renderer_Rich_Callable',
        'closure' => 'Kint_Renderer_Rich_Closure',
        'depth_limit' => 'Kint_Renderer_Rich_DepthLimit',
        'nothing' => 'Kint_Renderer_Rich_Nothing',
        'recursion' => 'Kint_Renderer_Rich_Recursion',
        'trace_frame' => 'Kint_Renderer_Rich_TraceFrame',
    );
    public static $representation_renderers = array(
        'docstring' => 'Kint_Renderer_Rich_Docstring',
        'fspath' => 'Kint_Renderer_Rich_FsPath',
        'microtime' => 'Kint_Renderer_Rich_Microtime',
        'source' => 'Kint_Renderer_Rich_Source',
    );

    /**
     * @var theme css file (Relative paths start at KINT_DIR/resources/compiled)
     */
    public static $theme = 'original.css';

    private static $been_run = false;
    private $modifiers;
    private $callee;
    private $mini_trace;
    private $previous_caller;

    public function __construct(array $names = null, array $parameters = null, $modifiers = null, array $callee = null, array $caller = null, array $mini_trace = array())
    {
        parent::__construct($names, $parameters, $modifiers, $callee, $caller, $mini_trace);

        $this->modifiers = $modifiers;
        $this->callee = $callee;
        $this->mini_trace = $mini_trace;
        $this->previous_caller = $caller;
    }

    public function render(Kint_Object $o)
    {
        if ($plugin = $this->getPlugin(self::$object_renderers, $o->hints)) {
            if ($output = $plugin->render($o)) {
                return $output;
            }
        }

        $children = $this->renderChildren($o);
        $header = self::renderHeaderWrapper($o, (bool) strlen($children), self::renderHeader($o));

        return '<dl>'.$header.$children.'</dl>';
    }

    public static function renderHeaderWrapper(Kint_Object $o, $has_children, $contents)
    {
        $open = '<dt';
        $close = '';

        if ($has_children) {
            $open .= ' class="kint-parent';

            if (Kint::$expanded) {
                $open .= ' kint-show';
            }

            $open .= '"';
        }

        $open .= '>';

        if ($o->depth > 0 && $ap = $o->getAccessPath()) {
            $open .= '<span class="kint-access-path-trigger" title="Show access path">&rlarr;</span>';
        }

        if ($has_children) {
            $open .= '<span class="kint-popup-trigger" title="Open in new window">&rarr;</span><nav></nav>';
        }

        if (!empty($ap)) {
            $close .= '<div class="access-path">'.Kint_Object_Blob::escape($ap).'</div>';
        }

        return $open.$contents.$close.'</dt>';
    }

    public static function renderHeader(Kint_Object $o)
    {
        $output = '';

        if (($s = $o->getModifiers()) !== null) {
            $output .= '<var>'.$s.'</var> ';
        }

        if (($s = $o->getName()) !== null) {
            $output .= '<dfn>'.Kint_Object_Blob::escape($s).'</dfn> ';

            if ($s = $o->getOperator()) {
                $output .= Kint_Object_Blob::escape($s).' ';
            }
        }

        if (($s = $o->getType()) !== null) {
            $output .= '<var>'.Kint_Object_Blob::escape($s).'</var>';
        }

        if (($s = $o->getSize()) !== null) {
            $output .= '('.$s.') ';
        }

        if (($s = $o->getValueShort()) !== null) {
            if (Kint_Object_Blob::strlen($s) > Kint::$max_str_length) {
                $s = substr($s, 0, Kint::$max_str_length).'...';
            }
            $output .= Kint_Object_Blob::escape($s);
        }

        return $output;
    }

    public function renderChildren(Kint_Object $o)
    {
        $contents = array();
        $tabs = array();

        foreach ($o->getRepresentations() as $rep) {
            $result = $this->renderRepresentation($o, $rep);
            if (Kint_Object_Blob::strlen($result)) {
                $contents[] = $result;
                $tabs[] = $rep;
            }
        }

        if (empty($tabs)) {
            return '';
        }

        $output = '<dd>';

        if (count($tabs) == 1 && $tabs[0]->labelIsImplicit()) {
            $output .= reset($contents);
        } else {
            $output .= '<ul class="kint-tabs">';

            foreach ($tabs as $i => $tab) {
                if ($i === 0) {
                    $output .= '<li class="kint-active-tab">';
                } else {
                    $output .= '<li>';
                }
                $output .= Kint_Object_Blob::escape($tab->getLabel()).'</li>';
            }

            $output .= '</ul><ul>';

            foreach ($contents as $tab) {
                $output .= '<li>'.$tab.'</li>';
            }

            $output .= '</ul>';
        }

        return $output.'</dd>';
    }

    private function renderRepresentation(Kint_Object $o, Kint_Object_Representation $rep)
    {
        if ($plugin = $this->getPlugin(self::$representation_renderers, $rep->hints)) {
            if ($output = $plugin->render($rep)) {
                return $output;
            }
        }

        if (is_array($rep->contents)) {
            $output = '';<commit_msg>Kint_Renderer_Rich: Allow plugins to output falsy strings<commit_after><?php

class Kint_Renderer_Rich extends Kint_Renderer
{
    public static $object_renderers = array(
        'callable' => 'Kint_Renderer_Rich_Callable',
        'closure' => 'Kint_Renderer_Rich_Closure',
        'depth_limit' => 'Kint_Renderer_Rich_DepthLimit',
        'nothing' => 'Kint_Renderer_Rich_Nothing',
        'recursion' => 'Kint_Renderer_Rich_Recursion',
        'trace_frame' => 'Kint_Renderer_Rich_TraceFrame',
    );
    public static $representation_renderers = array(
        'docstring' => 'Kint_Renderer_Rich_Docstring',
        'fspath' => 'Kint_Renderer_Rich_FsPath',
        'microtime' => 'Kint_Renderer_Rich_Microtime',
        'source' => 'Kint_Renderer_Rich_Source',
    );

    /**
     * @var theme css file (Relative paths start at KINT_DIR/resources/compiled)
     */
    public static $theme = 'original.css';

    private static $been_run = false;
    private $modifiers;
    private $callee;
    private $mini_trace;
    private $previous_caller;

    public function __construct(array $names = null, array $parameters = null, $modifiers = null, array $callee = null, array $caller = null, array $mini_trace = array())
    {
        parent::__construct($names, $parameters, $modifiers, $callee, $caller, $mini_trace);

        $this->modifiers = $modifiers;
        $this->callee = $callee;
        $this->mini_trace = $mini_trace;
        $this->previous_caller = $caller;
    }

    public function render(Kint_Object $o)
    {
        if ($plugin = $this->getPlugin(self::$object_renderers, $o->hints)) {
            if (strlen($output = $plugin->render($o))) {
                return $output;
            }
        }

        $children = $this->renderChildren($o);
        $header = self::renderHeaderWrapper($o, (bool) strlen($children), self::renderHeader($o));

        return '<dl>'.$header.$children.'</dl>';
    }

    public static function renderHeaderWrapper(Kint_Object $o, $has_children, $contents)
    {
        $open = '<dt';
        $close = '';

        if ($has_children) {
            $open .= ' class="kint-parent';

            if (Kint::$expanded) {
                $open .= ' kint-show';
            }

            $open .= '"';
        }

        $open .= '>';

        if ($o->depth > 0 && $ap = $o->getAccessPath()) {
            $open .= '<span class="kint-access-path-trigger" title="Show access path">&rlarr;</span>';
        }

        if ($has_children) {
            $open .= '<span class="kint-popup-trigger" title="Open in new window">&rarr;</span><nav></nav>';
        }

        if (!empty($ap)) {
            $close .= '<div class="access-path">'.Kint_Object_Blob::escape($ap).'</div>';
        }

        return $open.$contents.$close.'</dt>';
    }

    public static function renderHeader(Kint_Object $o)
    {
        $output = '';

        if (($s = $o->getModifiers()) !== null) {
            $output .= '<var>'.$s.'</var> ';
        }

        if (($s = $o->getName()) !== null) {
            $output .= '<dfn>'.Kint_Object_Blob::escape($s).'</dfn> ';

            if ($s = $o->getOperator()) {
                $output .= Kint_Object_Blob::escape($s).' ';
            }
        }

        if (($s = $o->getType()) !== null) {
            $output .= '<var>'.Kint_Object_Blob::escape($s).'</var>';
        }

        if (($s = $o->getSize()) !== null) {
            $output .= '('.$s.') ';
        }

        if (($s = $o->getValueShort()) !== null) {
            if (Kint_Object_Blob::strlen($s) > Kint::$max_str_length) {
                $s = substr($s, 0, Kint::$max_str_length).'...';
            }
            $output .= Kint_Object_Blob::escape($s);
        }

        return $output;
    }

    public function renderChildren(Kint_Object $o)
    {
        $contents = array();
        $tabs = array();

        foreach ($o->getRepresentations() as $rep) {
            $result = $this->renderRepresentation($o, $rep);
            if (Kint_Object_Blob::strlen($result)) {
                $contents[] = $result;
                $tabs[] = $rep;
            }
        }

        if (empty($tabs)) {
            return '';
        }

        $output = '<dd>';

        if (count($tabs) == 1 && $tabs[0]->labelIsImplicit()) {
            $output .= reset($contents);
        } else {
            $output .= '<ul class="kint-tabs">';

            foreach ($tabs as $i => $tab) {
                if ($i === 0) {
                    $output .= '<li class="kint-active-tab">';
                } else {
                    $output .= '<li>';
                }
                $output .= Kint_Object_Blob::escape($tab->getLabel()).'</li>';
            }

            $output .= '</ul><ul>';

            foreach ($contents as $tab) {
                $output .= '<li>'.$tab.'</li>';
            }

            $output .= '</ul>';
        }

        return $output.'</dd>';
    }

    private function renderRepresentation(Kint_Object $o, Kint_Object_Representation $rep)
    {
        if ($plugin = $this->getPlugin(self::$representation_renderers, $rep->hints)) {
            if (strlen($output = $plugin->render($rep))) {
                return $output;
            }
        }

        if (is_array($rep->contents)) {
            $output = '';
{'fraction_non_alphanumeric': 0.17731507891234075, 'fraction_numerical': 0.0009507510933637574, 'mean_word_length': 1.911430943814005, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 135, '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': '6235571', 'n_tokens_mistral': 3294, 'n_tokens_neox': 3181, 'n_words': 590}