TermStatus
in package
Value object representing a Term's learning status.
Encapsulates the business rules around term status transitions.
Status values:
- 1-5: Learning stages (1=new, 5=learned)
- 98: Ignored words
- 99: Well-known words
Tags
Table of Contents
Constants
- IGNORED = 98
- LEARNED = 5
- LEARNING_2 = 2
- LEARNING_3 = 3
- LEARNING_4 = 4
- NEW = 1
- WELL_KNOWN = 99
- VALID_STATUSES = [self::NEW, self::LEARNING_2, self::LEARNING_3, self::LEARNING_4, self::LEARNED, self::IGNORED, self::WELL_KNOWN]
Properties
- $value : int
Methods
- __toString() : string
- String representation.
- advance() : self
- Advance to the next learning stage.
- decrease() : self
- Decrease to the previous learning stage.
- equals() : bool
- Check equality with another TermStatus.
- fromInt() : self
- Create from a database value.
- ignored() : self
- Create an ignored status.
- isIgnored() : bool
- Check if the term is ignored.
- isKnown() : bool
- Check if the term is known (learned or well-known).
- isLearning() : bool
- Check if the term is in a learning stage (1-4).
- isSpecial() : bool
- Check if this is a special status (ignored or well-known).
- label() : string
- Get a human-readable label.
- learned() : self
- Create a learned status.
- needsReview() : bool
- Check if the term needs review (learning stages 1-4).
- new() : self
- Create a new (unknown) status.
- toInt() : int
- Get the integer value.
- wellKnown() : self
- Create a well-known status.
- __construct() : mixed
Constants
IGNORED
public
int
IGNORED
= 98
Ignored term
LEARNED
public
int
LEARNED
= 5
Fully learned
LEARNING_2
public
int
LEARNING_2
= 2
Learning stage 2
LEARNING_3
public
int
LEARNING_3
= 3
Learning stage 3
LEARNING_4
public
int
LEARNING_4
= 4
Learning stage 4
NEW
public
int
NEW
= 1
New/unknown term
WELL_KNOWN
public
int
WELL_KNOWN
= 99
Well-known term (no need to learn)
VALID_STATUSES
private
array<string|int, int>
VALID_STATUSES
= [self::NEW, self::LEARNING_2, self::LEARNING_3, self::LEARNING_4, self::LEARNED, self::IGNORED, self::WELL_KNOWN]
Valid status values
Properties
$value
private
int
$value
Methods
__toString()
String representation.
public
__toString() : string
Return values
stringadvance()
Advance to the next learning stage.
public
advance() : self
Returns a new TermStatus with the next stage, or the same status if already at maximum learning level or special status.
Return values
selfdecrease()
Decrease to the previous learning stage.
public
decrease() : self
Returns a new TermStatus with the previous stage, or the same status if already at minimum level or special status.
Return values
selfequals()
Check equality with another TermStatus.
public
equals(TermStatus $other) : bool
Parameters
- $other : TermStatus
-
The other status to compare
Return values
boolfromInt()
Create from a database value.
public
static fromInt(int $status) : self
Parameters
- $status : int
-
The status value from database
Tags
Return values
selfignored()
Create an ignored status.
public
static ignored() : self
Return values
selfisIgnored()
Check if the term is ignored.
public
isIgnored() : bool
Return values
boolisKnown()
Check if the term is known (learned or well-known).
public
isKnown() : bool
Return values
boolisLearning()
Check if the term is in a learning stage (1-4).
public
isLearning() : bool
Return values
boolisSpecial()
Check if this is a special status (ignored or well-known).
public
isSpecial() : bool
Return values
boollabel()
Get a human-readable label.
public
label() : string
Return values
stringlearned()
Create a learned status.
public
static learned() : self
Return values
selfneedsReview()
Check if the term needs review (learning stages 1-4).
public
needsReview() : bool
Return values
boolnew()
Create a new (unknown) status.
public
static new() : self
Return values
selftoInt()
Get the integer value.
public
toInt() : int
Return values
intwellKnown()
Create a well-known status.
public
static wellKnown() : self
Return values
self__construct()
private
__construct(int $value) : mixed
Parameters
- $value : int
-
The status value