public static function input($type, $name, $value = null, array $attributes = array())
    {
        if ($type === 'textarea') {
            $input = '<textarea{{attr}}>';

            if ($value !== null) {
                $input .= self::entities($value);
            }

            $input .= '</textarea>';
        } elseif (preg_match('#^(' . self::$alloweds . ')$#', $type)) {
            $input = '<input type="' . $type . '" value="';

            if ($value !== null) {
                $input .= self::entities($value);
            }

            $input .= '"{{attr}}' . self::$useXhtml . '>';
        } else {
            throw new Exception('Invalid type');
        }

        return self::setAttr($attributes, $input, $name, $type);
    }
public static function input($type, $name, $value = null, array $attributes = array())
    {
        if ($type === 'textarea') {
            $input = '<textarea{{attr}}>';

            if ($value !== null) {
                $input .= self::entities($value);
            }

            $input .= '</textarea>';
        } elseif (preg_match('#^(' . self::$alloweds . ')$#', $type)) {
            $input = '<input type="' . $type . '" value="';

            if ($value !== null) {
                $input .= self::entities($value);
            }

            $input .= '"{{attr}}' . self::$useXhtml . '>';
        } else {
            throw new Exception('Invalid type');
        }

        return self::setAttr($attributes, $input, $name, $type);
    }
public static function input ( $ type , $ name , $ value = null , array $ attributes = array ( ) ) { if ( $ type === 'textarea' ) { $ input = '<textarea{{attr}}>' ; if ( $ value !== null ) { $ input .= self :: entities ( $ value ) ; } $ input .= '</textarea>' ; } elseif ( preg_match ( '#^(' . self :: $ alloweds . ')$#' , $ type ) ) { $ input = '<input type="' . $ type . '" value="' ; if ( $ value !== null ) { $ input .= self :: entities ( $ value ) ; } $ input .= '"{{attr}}' . self :: $ useXhtml . '>' ; } else { throw new Exception ( 'Invalid type' ) ; } return self :: setAttr ( $ attributes , $ input , $ name , $ type ) ; }
Create a input or textarea

@param string      $type
@param string      $name
@param string|null $value
@param array       $attributes
@return string
Create a input or textarea