<commit_before><?php declare(strict_types=1);
/*
 * This file is part of the feed-io package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace FeedIo;

use FeedIo\Feed\NodeInterface;

abstract class RuleAbstract
{
    const NODE_NAME = 'node';

    /**
     * @var string
     */
    protected $nodeName;

    /**
     * @param string $nodeName
     */
    public function __construct(string $nodeName = null)
    {
        $this->nodeName = is_null($nodeName) ? static::NODE_NAME : $nodeName;
    }

    /**
     * @return string
     */
    public function getNodeName() : string
    {
        return $this->nodeName;
    }

    /**
     * @param  \DOMElement $element
     * @param  string      $name
     * @return string|null
     */
    public function getAttributeValue(\DOMElement $element, $name) : ? string
    {
        if ($element->hasAttribute($name)) {
            return $element->getAttribute($name);
        }

        return null;
    }

    /**
     * @param  \DOMElement $element
     * @param  string      $name
     * @return string|null
     */
    public function getChildValue(\DOMElement $element, string $name) : ? string
    {
        $list = $element->getElementsByTagName($name);
        if ($list->length > 0) {
            return $list->item(0)->nodeValue;
        }

        return null;<commit_msg>Optionnal namespace parameter for getChildValue method<commit_after><?php declare(strict_types=1);
/*
 * This file is part of the feed-io package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace FeedIo;

use FeedIo\Feed\NodeInterface;

abstract class RuleAbstract
{
    const NODE_NAME = 'node';

    /**
     * @var string
     */
    protected $nodeName;

    /**
     * @param string $nodeName
     */
    public function __construct(string $nodeName = null)
    {
        $this->nodeName = is_null($nodeName) ? static::NODE_NAME : $nodeName;
    }

    /**
     * @return string
     */
    public function getNodeName() : string
    {
        return $this->nodeName;
    }

    /**
     * @param  \DOMElement $element
     * @param  string      $name
     * @return string|null
     */
    public function getAttributeValue(\DOMElement $element, $name) : ? string
    {
        if ($element->hasAttribute($name)) {
            return $element->getAttribute($name);
        }

        return null;
    }

    /**
     * @param  \DOMElement $element
     * @param  string      $name
     * @param  string      $ns
     * @return string|null
     */
    public function getChildValue(\DOMElement $element, string $name, string $ns = "") : ? string
    {
        $list = $element->getElementsByTagNameNS($ns, $name);
        if ($list->length > 0) {
            return $list->item(0)->nodeValue;
        }

        return null;
{'fraction_non_alphanumeric': 0.12632978723404256, 'fraction_numerical': 0.0019946808510638296, 'mean_word_length': 2.194267515923567, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, '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': '6245837', 'n_tokens_mistral': 904, 'n_tokens_neox': 878, 'n_words': 230}