<commit_before><?php
declare(strict_types=1);

namespace WScore\Validation\Filters;

use WScore\Validation\Interfaces\FilterInterface;
use WScore\Validation\Interfaces\ResultInterface;

abstract class AbstractFilter implements FilterInterface
{
    private $addType = FilterInterface::ADD_APPEND;

    public function getAddType(): string
    {
        return $this->addType;
    }

    /**
     * @param string $addType
     */
    protected function setAddType(string $addType): void
    {
        $this->addType = $addType;
    }

    /**
     * returns name of the filter;
     * validation can have only one filter with the same name.
     *
     * @return string
     */
    public function getFilterName(): string
    {
        return get_class($this);
    }

    /**
     * @param ResultInterface $result
     * @param array $option
     * @param string $messages
     * @return ResultInterface
     */
    protected function failed(ResultInterface $result, $option = [], $messages = null)
    {
        return $result->failed(get_class($this), $option, $messages);
    }

    protected function isEmpty($value): bool
    {
        if (is_array($value)) {<commit_msg>add a case for object when checking the input value is an empty value.<commit_after><?php
declare(strict_types=1);

namespace WScore\Validation\Filters;

use WScore\Validation\Interfaces\FilterInterface;
use WScore\Validation\Interfaces\ResultInterface;

abstract class AbstractFilter implements FilterInterface
{
    private $addType = FilterInterface::ADD_APPEND;

    public function getAddType(): string
    {
        return $this->addType;
    }

    /**
     * @param string $addType
     */
    protected function setAddType(string $addType): void
    {
        $this->addType = $addType;
    }

    /**
     * returns name of the filter;
     * validation can have only one filter with the same name.
     *
     * @return string
     */
    public function getFilterName(): string
    {
        return get_class($this);
    }

    /**
     * @param ResultInterface $result
     * @param array $option
     * @param string $messages
     * @return ResultInterface
     */
    protected function failed(ResultInterface $result, $option = [], $messages = null)
    {
        return $result->failed(get_class($this), $option, $messages);
    }

    protected function isEmpty($value): bool
    {
        if (is_object($value)) {
            return false;
        }
        if (is_array($value)) {
{'fraction_non_alphanumeric': 0.10783521809369952, 'fraction_numerical': 0.0008077544426494346, 'mean_word_length': 2.69150521609538, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '4714822', 'n_tokens_mistral': 689, 'n_tokens_neox': 680, 'n_words': 183}