PollChoice
in package
implements
ArrayAccess
uses
ArrayAccessHelper
Represents one of the choices a user can vote for in a poll.
Table of Contents
Interfaces
- ArrayAccess
Properties
- $id : int
- $label : string
- $new : bool
- $poll : int
- $voted_this : bool
- $votes : int
- $prop_aliases : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructor.
- add() : void
- delete() : void
- offsetExists() : bool
- Checks whether a property has been set when object is accessed as an array.
- offsetGet() : mixed
- Gets properties when object is accessed as an array.
- offsetSet() : void
- Sets properties when object is accessed as an array.
- offsetUnset() : void
- Unsets properties when object is accessed as an array.
- save() : void
- Saves this poll choice.
- update() : void
Properties
$id
public
int
$id
This poll choice's ID number.
$label
public
string
$label
= ''
$new
public
bool
$new
= false
$poll
public
int
$poll
ID number of the poll this choice is connected to.
$voted_this
public
bool
$voted_this
= false
$votes
public
int
$votes
= 0
$prop_aliases
protected
array<string|int, mixed>
$prop_aliases
= ['id_choice' => 'id', 'id_poll' => 'poll']
Alternate names for some object properties.
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $props = [] ]) : mixed
Parameters
- $props : array<string|int, mixed> = []
-
Properties to set.
add()
public
add() : void
delete()
public
delete() : void
offsetExists()
Checks whether a property has been set when object is accessed as an array.
public
offsetExists(mixed $prop) : bool
Parameters
- $prop : mixed
-
The property name.
Return values
booloffsetGet()
Gets properties when object is accessed as an array.
public
& offsetGet(mixed $prop) : mixed
Parameters
- $prop : mixed
-
The property name.
Return values
mixed —A reference to the property.
offsetSet()
Sets properties when object is accessed as an array.
public
offsetSet(mixed $prop, mixed $value) : void
Parameters
- $prop : mixed
-
The property name.
- $value : mixed
-
The value to set.
offsetUnset()
Unsets properties when object is accessed as an array.
public
offsetUnset(mixed $prop) : void
Parameters
- $prop : mixed
-
The property name.
save()
Saves this poll choice.
public
save() : void
Calls $this->add(), $this->update(), or $this->delete() as necessary.
update()
public
update() : void