<commit_before><?php

/**
 * This file provides form related helper functions
 *
 * @package     Nails
 * @subpackage  common
 * @category    Helper
 * @author      Nails Dev Team
 * @link
 */

use Nails\Factory;

if (!function_exists('form_email')) {

    /**
     * Generates an input using the "email" type
     *
     * @param  mixed  $data  The field's name or the config array
     * @param  mixed  $value The form element's value
     * @param  string $extra Any additional attributes to give to the field
     *
     * @return string
     */
    function form_email($data = '', $value = '', $extra = '')
    {
        $defaults = [
            'type'  => 'email',
            'name'  => !is_array($data) ? $data : '',
            'value' => $value,
        ];

        return '<input ' . _parse_form_attributes($data, $defaults) . $extra . ' />';
    }
}

// --------------------------------------------------------------------------

if (!function_exists('form_tel')) {

    /**
     * Generates an input using the "tel" type<commit_msg>Added form_text, alias of form_input<commit_after><?php

/**
 * This file provides form related helper functions
 *
 * @package     Nails
 * @subpackage  common
 * @category    Helper
 * @author      Nails Dev Team
 * @link
 */

use Nails\Factory;

if (!function_exists('form_text')) {

    /**
     * Alias of form_input
     *
     * @param    mixed
     * @param    string
     * @param    mixed
     *
     * @return    string
     */
    function form_text($data = '', $value = '', $extra = '')
    {
        return form_input($data, $value, $extra);
    }
}

if (!function_exists('form_email')) {

    /**
     * Generates an input using the "email" type
     *
     * @param  mixed  $data  The field's name or the config array
     * @param  mixed  $value The form element's value
     * @param  string $extra Any additional attributes to give to the field
     *
     * @return string
     */
    function form_email($data = '', $value = '', $extra = '')
    {
        $defaults = [
            'type'  => 'email',
            'name'  => !is_array($data) ? $data : '',
            'value' => $value,
        ];

        return '<input ' . _parse_form_attributes($data, $defaults) . $extra . ' />';
    }
}

// --------------------------------------------------------------------------

if (!function_exists('form_tel')) {

    /**
     * Generates an input using the "tel" type
{'fraction_non_alphanumeric': 0.19662690250925546, 'fraction_numerical': 0.0, 'mean_word_length': 1.741826381059752, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '7509842', 'n_tokens_mistral': 716, 'n_tokens_neox': 700, 'n_words': 196}