MockTable
        
        extends Table
    
    
            
            in package
            
        
    
    
    
HTML Table Generating Class
Lets you create tables manually or from database result objects, or arrays.
Table of Contents
Properties
- $autoHeading : bool
 - Whether or not to automatically create the table header
 - $caption : string|null
 - Table caption
 - $emptyCells : string
 - Contents of empty cells
 - $footing : array<int, mixed>
 - Data for table footing
 - $function : callable|null
 - Callback for custom table layout
 - $heading : array<int, mixed>
 - Data for table heading
 - $newline : string
 - Newline setting
 - $rows : array<int, array<string, string>>|array<int, array<int, array<string, string>>>
 - Data for table rows
 - $template : array<string, string>
 - Table layout template
 
Methods
- __call() : mixed
 - Override inaccessible protected method
 - __construct() : mixed
 - Set the template from the table config file if it exists
 - addRow() : Table
 - Add a table row
 - clear() : Table
 - Clears the table arrays. Useful if multiple tables are being generated
 - generate() : string
 - Generate the table
 - makeColumns() : array<int, mixed>|false
 - Set columns. Takes a one-dimensional array as input and creates a multi-dimensional array with a depth equal to the number of columns. This allows a single array with many elements to be displayed in a table that has a fixed column count.
 - setCaption() : Table
 - Add a table caption
 - setEmpty() : Table
 - Set "empty" cells
 - setFooting() : Table
 - Set the table footing
 - setHeading() : Table
 - Set the table heading
 - setSyncRowsWithHeading() : $this
 - Set to true if each row column should be synced by keys defined in heading.
 - setTemplate() : bool
 - Set the template
 - _compileTemplate() : void
 - Compile Template
 - _defaultTemplate() : array<string, string>
 - Default Template
 - _prepArgs() : array<string, array<string, mixed>>|array<int, array<string, mixed>>
 - Prep Args
 - _setFromArray() : void
 - Set table data from an array
 - _setFromDBResult() : void
 - Set table data from a database result object
 
Properties
$autoHeading
Whether or not to automatically create the table header
        public
            bool
    $autoHeading
     = true
    
    
    
    
    
$caption
Table caption
        public
            string|null
    $caption
    
    
    
    
    
    
$emptyCells
Contents of empty cells
        public
            string
    $emptyCells
     = ''
    
    
    
    
    
$footing
Data for table footing
        public
            array<int, mixed>
    $footing
     = []
    
    
    
    
    
$function
Callback for custom table layout
        public
            callable|null
    $function
    
    
    
    
    
    
$heading
Data for table heading
        public
            array<int, mixed>
    $heading
     = []
    
    
    
    
    
$newline
Newline setting
        public
            string
    $newline
     = "\n"
    
    
    
    
    
$rows
Data for table rows
        public
            array<int, array<string, string>>|array<int, array<int, array<string, string>>>
    $rows
     = []
    
    
    
    
    
$template
Table layout template
        public
            array<string, string>
    $template
    
    
    
    
    
    
Methods
__call()
Override inaccessible protected method
    public
                    __call(string $method, array<int, mixed> $params) : mixed
    Parameters
- $method : string
 - $params : array<int, mixed>
 
__construct()
Set the template from the table config file if it exists
    public
                    __construct([array<string, string> $config = [] ]) : mixed
    Parameters
- $config : array<string, string> = []
 - 
                    
(default: array())
 
addRow()
Add a table row
    public
                    addRow() : Table
    Can be passed as an array or discreet params
Return values
Tableclear()
Clears the table arrays. Useful if multiple tables are being generated
    public
                    clear() : Table
    Return values
Tablegenerate()
Generate the table
    public
                    generate([array<int, mixed>|BaseResult|null $tableData = null ]) : string
    Parameters
- $tableData : array<int, mixed>|BaseResult|null = null
 
Return values
stringmakeColumns()
Set columns. Takes a one-dimensional array as input and creates a multi-dimensional array with a depth equal to the number of columns. This allows a single array with many elements to be displayed in a table that has a fixed column count.
    public
                    makeColumns([array<int, string> $array = [] ][, int $columnLimit = 0 ]) : array<int, mixed>|false
    Parameters
- $array : array<int, string> = []
 - $columnLimit : int = 0
 
Return values
array<int, mixed>|falsesetCaption()
Add a table caption
    public
                    setCaption(string $caption) : Table
    Parameters
- $caption : string
 
Return values
TablesetEmpty()
Set "empty" cells
    public
                    setEmpty(string $value) : Table
    Parameters
- $value : string
 
Return values
TablesetFooting()
Set the table footing
    public
                    setFooting() : Table
    Can be passed as an array or discreet params
Return values
TablesetHeading()
Set the table heading
    public
                    setHeading() : Table
    Can be passed as an array or discreet params
Return values
TablesetSyncRowsWithHeading()
Set to true if each row column should be synced by keys defined in heading.
    public
                    setSyncRowsWithHeading(bool $orderByKey) : $this
    If a row has a key which does not exist in heading, it will be filtered out If a row does not have a key which exists in heading, the field will stay empty
Parameters
- $orderByKey : bool
 
Return values
$thissetTemplate()
Set the template
    public
                    setTemplate(array<string, string>|string $template) : bool
    Parameters
- $template : array<string, string>|string
 
Return values
bool_compileTemplate()
Compile Template
    protected
                    _compileTemplate() : void
    _defaultTemplate()
Default Template
    protected
                    _defaultTemplate() : array<string, string>
    Return values
array<string, string>_prepArgs()
Prep Args
    protected
                    _prepArgs(array<int, mixed> $args) : array<string, array<string, mixed>>|array<int, array<string, mixed>>
    Ensures a standard associative array format for all cell data
Parameters
- $args : array<int, mixed>
 
Return values
array<string, array<string, mixed>>|array<int, array<string, mixed>>_setFromArray()
Set table data from an array
    protected
                    _setFromArray(array<int, mixed> $data) : void
    Parameters
- $data : array<int, mixed>
 
_setFromDBResult()
Set table data from a database result object
    protected
                    _setFromDBResult(BaseResult $object) : void
    Parameters
- $object : BaseResult
 - 
                    
Database result object