Properties

$_data

$_data : array

Type

array — - The user information object

$_updates

$_updates : \ptejada\uFlex\Collection

Type

\ptejada\uFlex\Collection — - Updates for the user information object

Methods

__construct()

__construct(array $userData)

Initializes the the User object

Parameters

array $userData

addValidation()

addValidation(string|array $name, string $limit, string|bool $regEx) : null

Adds validation to queue for either the Registration or Update Method Single Entry: Requires the first two parameters $name = string (name of the field to be validated) $limit = string (range of the accepted value length in the format of "5-10") - to make a field optional start with 0 (Ex. "0-10") Optional third parameter $regEx = string (Regular Expression to test the field) _____________________________________________________________________________________________________ Multiple Entry:

Takes only the first argument

   $name = Array Object (takes an object in the following format:
       array(
           "Username" => array(
                   "limit" => "3-15",
                   "regEx" => "/^([a-zA-Z0-9_])+$/"
                   ),
           "Password" => array(
                   "limit" => "3-15",
                   "regEx" => false
                   )
           );

Parameters

string|array $name

Name of the field to validate or an array of all the fields and their validations

string $limit

A range of the accepted value length in the format of "5-10", to make a field optional

                       start with 0 (Ex. "0-10")
string|bool $regEx

Regular expression to the test the field with

Returns

null

getProperty()

getProperty(mixed $name) : mixed

Get the value of a user property

Parameters

mixed $name

Returns

mixed

__get()

__get(mixed $name) : mixed|null

Get the value of a user property

Parameters

mixed $name

Returns

mixed|null

__set()

__set(mixed $name, mixed $value)

Queues any updates to user properties

Parameters

mixed $name
mixed $value

toArray()

toArray() : array

Get all the user fields as an array

Returns

array

toCollection()

toCollection(mixed $data) : \ptejada\uFlex\Collection

Check if the data is a Collection if an array convert it to a Collection

Parameters

mixed $data

Returns

\ptejada\uFlex\Collection

validateAll()

validateAll(bool $includeAllRules) : bool

Validates All fields in _updates queue

Parameters

bool $includeAllRules
  • Will also run rules not validated

Returns

bool

validate()

validate(string $name, string $limit, bool|string $regEx) : bool

Validates a field in tmp_data

Parameters

string $name

field name

string $limit

valid value length range, Ex: '0-10'

bool|string $regEx

regular expression to test the field against

Returns

bool