<commit_before><?php

namespace CodeJetter\components\contact\mappers;

use CodeJetter\core\BaseMapper;
use CodeJetter\core\io\Input;
use CodeJetter\core\io\Output;
use CodeJetter\core\security\Validator;
use CodeJetter\core\security\ValidatorRule;

class ContactMessageMapper extends BaseMapper
{
    public function add(array $inputs)
    {
        /**
         * Start validating
         */
        $output = new Output();
        try {
            $requiredRule = new ValidatorRule('required');
            $emailRule = new ValidatorRule('email');

            $definedInputs = [
                new Input('name'),
                new Input('email', [$requiredRule, $emailRule]),
                new Input('message', [$requiredRule])
            ];

            $validator = new Validator($definedInputs, $inputs);
            $validatorOutput = $validator->validate();

            if ($validatorOutput->getSuccess() !== true) {
                $output->setSuccess(false);
                $output->setMessages($validatorOutput->getMessages());
                return $output;
            }
        } catch (\Exception $e) {
            (new \CodeJetter\core\ErrorHandler())->logError($e);
        }
        /**
         * Finish validating
         */

        /**
         * Start inserting
         */
        $name = isset($inputs['name']) ? $inputs['name'] : '';

        $fieldsValues = [
            [
                'column' => 'name',
                'value' => $name,

            ],
            [
                'column' => 'email',
                'value' => $inputs['email'],

            ],
            [
                'column' => 'message',
                'value' => $inputs['message'],

            ],
        ];

        $insertedId = $this->insertOne($fieldsValues);

        $output = new Output();
        if (!empty($insertedId) && is_numeric($insertedId) && (int) $insertedId > 0) {
            $output->setSuccess(true);
            $output->setData($insertedId);
        } else {
            $output->setSuccess(false);
        }
        /**
         * Finish inserting
         */

        return $output;
    }
}<commit_msg>Remove empty lines<commit_after><?php

namespace CodeJetter\components\contact\mappers;

use CodeJetter\core\BaseMapper;
use CodeJetter\core\io\Input;
use CodeJetter\core\io\Output;
use CodeJetter\core\security\Validator;
use CodeJetter\core\security\ValidatorRule;

class ContactMessageMapper extends BaseMapper
{
    public function add(array $inputs)
    {
        /**
         * Start validating
         */
        $output = new Output();
        try {
            $requiredRule = new ValidatorRule('required');
            $emailRule = new ValidatorRule('email');

            $definedInputs = [
                new Input('name'),
                new Input('email', [$requiredRule, $emailRule]),
                new Input('message', [$requiredRule])
            ];

            $validator = new Validator($definedInputs, $inputs);
            $validatorOutput = $validator->validate();

            if ($validatorOutput->getSuccess() !== true) {
                $output->setSuccess(false);
                $output->setMessages($validatorOutput->getMessages());
                return $output;
            }
        } catch (\Exception $e) {
            (new \CodeJetter\core\ErrorHandler())->logError($e);
        }
        /**
         * Finish validating
         */

        /**
         * Start inserting
         */
        $name = isset($inputs['name']) ? $inputs['name'] : '';

        $fieldsValues = [
            [
                'column' => 'name',
                'value' => $name,
            ],
            [
                'column' => 'email',
                'value' => $inputs['email'],
            ],
            [
                'column' => 'message',
                'value' => $inputs['message'],
            ],
        ];

        $insertedId = $this->insertOne($fieldsValues);

        $output = new Output();
        if (!empty($insertedId) && is_numeric($insertedId) && (int) $insertedId > 0) {
            $output->setSuccess(true);
            $output->setData($insertedId);
        } else {
            $output->setSuccess(false);
        }
        /**
         * Finish inserting
         */

        return $output;
    }
}
{'fraction_non_alphanumeric': 0.14391485423415085, 'fraction_numerical': 0.00046274872744099955, 'mean_word_length': 1.5762812872467222, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '1455707', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1127, 'n_words': 202}