<commit_before><?php

/*
 * This file is part of the PhpTabs package.
 *
 * Copyright (c) landrok at github.com/landrok
 *
 * For the full copyright and license information, please see
 * <https://github.com/stdtabs/phptabs/blob/master/LICENSE>.
 */

namespace PhpTabs\Component\Serializer;

abstract class SerializerBase
{
    /**
     * Walk a node list and append them
     */
    protected function appendNodes(array $nodes): void
    {
        array_walk(
            $nodes,
            function ($node, $index) {
                // List
                if (is_array($node) && is_int($index)) {

                    $this->appendNodes($node);

                // Node
                } elseif (is_array($node) && !is_int($index)) {

                    $this->appendNode($index, $node);

                // Text
                } elseif (!is_array($node)) {

                    $this->appendText($index, $node);
                }
            }
        );
    }
}<commit_msg>Serializer - Enforce implementation<commit_after><?php

/*
 * This file is part of the PhpTabs package.
 *
 * Copyright (c) landrok at github.com/landrok
 *
 * For the full copyright and license information, please see
 * <https://github.com/stdtabs/phptabs/blob/master/LICENSE>.
 */

namespace PhpTabs\Component\Serializer;

abstract class SerializerBase
{
    /**
     * Walk a node list and append them
     */
    protected function appendNodes(array $nodes): void
    {
        array_walk(
            $nodes,
            function ($node, $index) {
                // List
                if (is_array($node) && is_int($index)) {

                    $this->appendNodes($node);

                // Node
                } elseif (is_array($node) && !is_int($index)) {

                    $this->appendNode($index, $node);

                // Text
                } elseif (!is_array($node)) {

                    $this->appendText($index, $node);
                }
            }
        );
    }

    protected abstract function appendNode(string $index, array $element): void;
    protected abstract function appendText(string $index, array $element): void;
}
{'fraction_non_alphanumeric': 0.12435957149510946, 'fraction_numerical': 0.0, 'mean_word_length': 1.7052896725440807, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '821171', 'n_tokens_mistral': 606, 'n_tokens_neox': 583, 'n_words': 142}