Text UI
A simple and fast way to take user input and display output in text mode using PHP.
Loading...
Searching...
No Matches
DateEntry Class Reference
Inheritance diagram for DateEntry:
EntryInterface

Public Member Functions

 __construct (string $label, string $format)
 
 setParser (?object $parser)
 
 read ()
 
- Public Member Functions inherited from EntryInterface

Protected Attributes

readonly string $label
 
readonly string $format
 
object $parser = null
 

Detailed Description

Receives a date from the user.

Converts user input into a PHP DateTime object using date_create_from_format().

Optionally, you can process user input with a parser defined by DateTimeEntry:setParser().

Author
everton3x

Definition at line 20 of file DateEntry.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( string $label,
string $format )
Parameters
string$label
string$formatA format string accepted by date_create_from_format().

Definition at line 32 of file DateEntry.php.

Member Function Documentation

◆ read()

read ( )

Implements EntryInterface.

Definition at line 54 of file DateEntry.php.

◆ setParser()

setParser ( ?object $parser)

A parser function that will be called by DateTimeEntry::parser($entry), where $entry is the user input.

The parser must return a string capable of being processed by date_create_from_format() according to DateTimeEntry::$format

Parameters
null | object$parser
Returns
DateEntry

Definition at line 48 of file DateEntry.php.

Field Documentation

◆ $format

readonly string $format
protected

Definition at line 23 of file DateEntry.php.

◆ $label

readonly string $label
protected

Definition at line 22 of file DateEntry.php.

◆ $parser

object $parser = null
protected

Definition at line 24 of file DateEntry.php.


The documentation for this class was generated from the following file: