CompletionRequirement
in package
Completion Requirement Object
Represents a completion requirement for a module item in Canvas LMS. This is a read-only object that is embedded within ModuleItem responses.
Table of Contents
Properties
- $completed : bool|null
- Whether the calling user has met this requirement (Optional; present only if the caller is a student or if the optional parameter 'student_id' is included)
- $minPercentage : float|null
- Minimum percentage required to complete (only present when type == 'min_percentage')
- $minScore : float|null
- Minimum score required to complete (only present when type == 'min_score')
- $type : string|null
- The type of completion requirement One of: 'must_view', 'must_submit', 'must_contribute', 'min_score', 'min_percentage', 'must_mark_done'
Methods
- __construct() : mixed
- Constructor
- getCompleted() : bool|null
- Get whether the requirement is completed
- getMinPercentage() : float|null
- Get the minimum percentage required
- getMinScore() : float|null
- Get the minimum score required
- getType() : string|null
- Get the type of completion requirement
- isPercentageBased() : bool
- Check if this is a percentage-based requirement
- isScoreBased() : bool
- Check if this is a score-based requirement
- setCompleted() : void
- Set whether the requirement is completed
- setMinPercentage() : void
- Set the minimum percentage required
- setMinScore() : void
- Set the minimum score required
- setType() : void
- Set the type of completion requirement
- toArray() : array<string|int, mixed>
- Convert to array
Properties
$completed
Whether the calling user has met this requirement (Optional; present only if the caller is a student or if the optional parameter 'student_id' is included)
public
bool|null
$completed
= null
$minPercentage
Minimum percentage required to complete (only present when type == 'min_percentage')
public
float|null
$minPercentage
= null
$minScore
Minimum score required to complete (only present when type == 'min_score')
public
float|null
$minScore
= null
$type
The type of completion requirement One of: 'must_view', 'must_submit', 'must_contribute', 'min_score', 'min_percentage', 'must_mark_done'
public
string|null
$type
= null
Methods
__construct()
Constructor
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
getCompleted()
Get whether the requirement is completed
public
getCompleted() : bool|null
Return values
bool|nullgetMinPercentage()
Get the minimum percentage required
public
getMinPercentage() : float|null
Return values
float|nullgetMinScore()
Get the minimum score required
public
getMinScore() : float|null
Return values
float|nullgetType()
Get the type of completion requirement
public
getType() : string|null
Return values
string|nullisPercentageBased()
Check if this is a percentage-based requirement
public
isPercentageBased() : bool
Return values
boolisScoreBased()
Check if this is a score-based requirement
public
isScoreBased() : bool
Return values
boolsetCompleted()
Set whether the requirement is completed
public
setCompleted(bool|null $completed) : void
Parameters
- $completed : bool|null
setMinPercentage()
Set the minimum percentage required
public
setMinPercentage(float|null $minPercentage) : void
Parameters
- $minPercentage : float|null
setMinScore()
Set the minimum score required
public
setMinScore(float|null $minScore) : void
Parameters
- $minScore : float|null
setType()
Set the type of completion requirement
public
setType(string|null $type) : void
Parameters
- $type : string|null
toArray()
Convert to array
public
toArray() : array<string|int, mixed>