Documentation

GroupFeedback extends FeedbackBase Uses StaticFactoryTrait

User Extended by Shawn Clake Class GroupFeedback User Extended is licensed under the MIT license.

Tags
author

Shawn Clake shawn.clake@gmail.com

link
https://github.com/ShawnClake/UserExtended
license

https://github.com/ShawnClake/UserExtended/blob/master/LICENSE MIT

Group Feedback provides group feedback messages, it supports Flash and div based feedback. You can use both or either or. Example calls look like this:

Feedback::with($myValidator)->generate()->flash()->display('#myDiv'); Feedback::with($myValidator)->generate()->display('#myDiv'); Feedback::with($myValidator)->generate()->flash();

Table of Contents

$div  : array<string|int, mixed>
Div messages Includes success, error, and false
$divOutput  : mixed
String to output in the destination div
$flash  : array<string|int, mixed>
FLash messages Includes success, error, and false
$flashOutput  : mixed
String to output in a flash message
$status  : int
Feedback status Includes -1 => Failure, 0 => False, 1 => Success
$validator  : Validator
Validator Instance
__callStatic()  : mixed
Main factory function which utilizes PHP's magic method to call a suffixed factory function on the child class.
customDivMessages()  : array<string|int, mixed>
Generic Div Messages
customFlashMessages()  : array<string|int, mixed>
Generic Flash Messages
display()  : array<string|int, mixed>
Returns an array with the key being a destination div and the value being the HTML to put in it.
factory()  : mixed
Helper function which can also be used to simply create an instance of a child class in cases where initialization functions aren't needed.
flash()  : mixed
Flashes the feedback to the screen
generate()  : mixed
Generates the feedback strings for flash and divs Also sets the feedback status
with()  :
withFactory()  : $this
Factory method for setting up the custom flash and div messages and adding in the validator

Properties

$div

Div messages Includes success, error, and false

private array<string|int, mixed> $div = []

$divOutput

String to output in the destination div

private mixed $divOutput

$flash

FLash messages Includes success, error, and false

private array<string|int, mixed> $flash = []

$flashOutput

String to output in a flash message

private mixed $flashOutput

$status

Feedback status Includes -1 => Failure, 0 => False, 1 => Success

private int $status

Methods

__callStatic()

Main factory function which utilizes PHP's magic method to call a suffixed factory function on the child class.

public static __callStatic( $name,  $arguments) : mixed
Parameters
$name :
$arguments :
Return values
mixed

customDivMessages()

Generic Div Messages

public customDivMessages() : array<string|int, mixed>
Return values
array<string|int, mixed>

customFlashMessages()

Generic Flash Messages

public customFlashMessages() : array<string|int, mixed>
Return values
array<string|int, mixed>

display()

Returns an array with the key being a destination div and the value being the HTML to put in it.

public display( $destinationDiv) : array<string|int, mixed>

Works out of the box for backend pages, might not be as simple for front end pages. Returning the contents of this from an AJAX handler should update the applicable divs.

Parameters
$destinationDiv :
Return values
array<string|int, mixed>

factory()

Helper function which can also be used to simply create an instance of a child class in cases where initialization functions aren't needed.

public static factory() : mixed

Generally you will want to use the static magic method below.

Return values
mixed

flash()

Flashes the feedback to the screen

public flash() : mixed
Return values
mixed

generate()

Generates the feedback strings for flash and divs Also sets the feedback status

public generate(mixed $flashErrors) : mixed
Parameters
$flashErrors : mixed
Return values
mixed

with()

public static with(mixed $validator, mixed $flashErrors, mixed $flash, mixed $div) :

FeedbackBase

Parameters
$validator : mixed
$flashErrors : mixed
$flash : mixed
$div : mixed
Return values

withFactory()

Factory method for setting up the custom flash and div messages and adding in the validator

public withFactory( $validator[, mixed $flashErrors = false ][, array<string|int, mixed> $flash = [] ][, array<string|int, mixed> $div = [] ]) : $this
Parameters
$validator :
$flashErrors : mixed = false
$flash : array<string|int, mixed> = []
$div : array<string|int, mixed> = []
Return values
$this

Search results