\Charcoal\ObjectUserData

User Data is a base model for objects typically submitted by the end-user of the application.

Summary

Methods
Properties
Constants
setIp()
ip()
setLang()
lang()
setOrigin()
resolveOrigin()
origin()
setTs()
ts()
preSave()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$ip
$lang
$origin
$ts
N/A

Properties

$ip

$ip : integer|null

Client IP address of the end-user.

Type

integer|null

$lang

$lang : string|null

Language of the end-user or source URI.

Type

string|null

$origin

$origin : string|null

Source URL or identifier of end-user submission.

Type

string|null

$ts

$ts : \DateTimeInterface|null

Creation timestamp of submission.

Type

\DateTimeInterface|null

Methods

setIp()

setIp(integer|null  $ip) : \Charcoal\Object\UserDataInterface

Set the client IP address.

Parameters

integer|null $ip

The remote IP at object creation.

Returns

\Charcoal\Object\UserDataInterface

Chainable

ip()

ip() : integer|null

Retrieve the client IP address.

Returns

integer|null

setLang()

setLang(string  $lang) : \Charcoal\Object\UserDataInterface

Set the origin language.

Parameters

string $lang

The language code.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\Object\UserDataInterface

Chainable

lang()

lang() : string

Retrieve the language.

Returns

string

setOrigin()

setOrigin(string  $origin) : \Charcoal\Object\UserDataInterface

Set the origin of the object submission.

Parameters

string $origin

The source URL or identifier of the submission.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\Object\UserDataInterface

Chainable

resolveOrigin()

resolveOrigin() : string

Resolve the origin of the user data.

Returns

string

origin()

origin() : string

Retrieve the origin of the object submission.

Returns

string

setTs()

setTs(\DateTime|string|null  $timestamp) : \Charcoal\Object\UserDataInterface

Set when the object was created.

Parameters

\DateTime|string|null $timestamp

The timestamp at object's creation. NULL is accepted and instances of DateTimeInterface are recommended; any other value will be converted (if possible) into one.

Throws

\InvalidArgumentException

If the timestamp is invalid.

Returns

\Charcoal\Object\UserDataInterface

Chainable

ts()

ts() : \DateTime|null

Retrieve the creation timestamp.

Returns

\DateTime|null

preSave()

preSave() : boolean

Event called before _creating_ the object.

Returns

boolean