PHP Classes

File: src/Script/Action/HtmlReader.php

Recommend this page to a friend!
  Packages of Thierry Feuzeu   Jaxon   src/Script/Action/HtmlReader.php   Download  
File: src/Script/Action/HtmlReader.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,481 bytes
 

Contents

Class file image Download
<?php

/**
 * HtmlReader.php
 *
 * Helpers functions to read 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
HtmlReader
{
   
/**
     * The class constructor
     *
     * @param string $sElementId
     */
   
public function __construct(private string $sElementId = '')
    {}

   
/**
     * @return array
     */
   
public function form(): array
    {
        return [
'_type' => 'form', '_name' => $this->sElementId];
    }

   
/**
     * @return array
     */
   
public function checked(): array
    {
        return [
'_type' => 'checked', '_name' => $this->sElementId];
    }

   
/**
     * @return HtmlValue
     */
   
public function input(): HtmlValue
   
{
        return new
HtmlValue(['_type' => 'input', '_name' => $this->sElementId]);
    }

   
/**
     * @return HtmlValue
     */
   
public function select(): HtmlValue
   
{
        return
$this->input();
    }

   
/**
     * @return HtmlValue
     */
   
public function html(): HtmlValue
   
{
        return new
HtmlValue(['_type' => 'html', '_name' => $this->sElementId]);
    }

   
/**
     * @return PageValue
     */
   
public function page(): PageValue
   
{
        return
TypedValue::page();
    }
}