PHP Classes

File: src/Script/Action/HtmlValue.php

Recommend this page to a friend!
  Packages of Thierry Feuzeu   Jaxon   src/Script/Action/HtmlValue.php   Download  
File: src/Script/Action/HtmlValue.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon
Call PHP classes from JavaScript using AJAX
Author: By
Last change:
Date: 4 months ago
Size: 1,179 bytes
 

Contents

Class file image Download
<?php

/**
 * HtmlValue.php
 *
 * Wrapper for values from web pages or forms.
 *
 * @package jaxon-core
 * @author Thierry Feuzeu <thierry.feuzeu@gmail.com>
 * @copyright 2025 Thierry Feuzeu <thierry.feuzeu@gmail.com>
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
 * @link https://github.com/jaxon-php/jaxon-core
 */

namespace Jaxon\Script\Action;

class
HtmlValue extends TypedValue
{
   
/**
     * The class contructor
     *
     * @param array $aValue
     */
   
public function __construct(protected array $aValue)
    {}

   
/**
     * @inheritDoc
     */
   
public function getType(): string
   
{
        return
$this->aValue['_type'] ?? '_';
    }

   
/**
     * Convert the js value to int
     *
     * @return self
     */
   
public function toInt(): self
   
{
       
$this->aValue['toInt'] = true;
        return
$this;
    }

   
/**
     * Trim the js value
     *
     * @return self
     */
   
public function trim(): self
   
{
       
$this->aValue['trim'] = true;
        return
$this;
    }

   
/**
     * @return array
     */
   
public function jsonSerialize(): array
    {
        return
$this->aValue;
    }
}