Documentation

TermStatus

Read onlyYes
FinalYes

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
since
3.0.0

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

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

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

Methods

__toString()

String representation.

public __toString() : string
Return values
string

advance()

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
self

decrease()

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
self

equals()

Check equality with another TermStatus.

public equals(TermStatus $other) : bool
Parameters
$other : TermStatus

The other status to compare

Return values
bool

fromInt()

Create from a database value.

public static fromInt(int $status) : self
Parameters
$status : int

The status value from database

Tags
throws
InvalidArgumentException

If status is invalid

Return values
self

ignored()

Create an ignored status.

public static ignored() : self
Return values
self

isIgnored()

Check if the term is ignored.

public isIgnored() : bool
Return values
bool

isKnown()

Check if the term is known (learned or well-known).

public isKnown() : bool
Return values
bool

isLearning()

Check if the term is in a learning stage (1-4).

public isLearning() : bool
Return values
bool

isSpecial()

Check if this is a special status (ignored or well-known).

public isSpecial() : bool
Return values
bool

label()

Get a human-readable label.

public label() : string
Return values
string

learned()

Create a learned status.

public static learned() : self
Return values
self

needsReview()

Check if the term needs review (learning stages 1-4).

public needsReview() : bool
Return values
bool

new()

Create a new (unknown) status.

public static new() : self
Return values
self

toInt()

Get the integer value.

public toInt() : int
Return values
int

wellKnown()

Create a well-known status.

public static wellKnown() : self
Return values
self

__construct()

private __construct(int $value) : mixed
Parameters
$value : int

The status value


        
On this page

Search results