Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
question_attempt_iterator Class Reference

A class abstracting access to the question_usage_by_activity::$questionattempts array. More...

Inheritance diagram for question_attempt_iterator:

Public Member Functions

 __construct (question_usage_by_activity $quba)
 To create an instance of this class, use question_usage_by_activity::get_attempt_iterator().
 
 current ()
 Standard part of the Iterator interface.
 
 key ()
 Standard part of the Iterator interface.
 
 next ()
 Standard part of the Iterator interface.
 
 offsetExists ($slot)
 Standard part of the ArrayAccess interface.
 
 offsetGet ($slot)
 Standard part of the ArrayAccess interface.
 
 offsetSet ($slot, $value)
 Standard part of the ArrayAccess interface.
 
 offsetUnset ($slot)
 Standard part of the ArrayAccess interface.
 
 rewind ()
 Standard part of the Iterator interface.
 
 valid ()
 Standard part of the Iterator interface.
 

Protected Attributes

question_usage_by_activity $quba
 that we are iterating over.
 
array $slots
 of slot numbers.
 

Detailed Description

A class abstracting access to the question_usage_by_activity::$questionattempts array.

This class snapshots the list of question_attempts to iterate over when it is created. If a question is added to the usage mid-iteration, it will now show up.

To create an instance of this class, use question_usage_by_activity::get_attempt_iterator()

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

question_attempt_iterator::__construct ( question_usage_by_activity $quba)

To create an instance of this class, use question_usage_by_activity::get_attempt_iterator().

Parameters
question_usage_by_activity$qubathe usage to iterate over.

Member Function Documentation

◆ current()

question_attempt_iterator::current ( )

Standard part of the Iterator interface.

Return values
question_attempt

◆ key()

question_attempt_iterator::key ( )

Standard part of the Iterator interface.

Return values
int

◆ offsetExists()

question_attempt_iterator::offsetExists ( $slot)

Standard part of the ArrayAccess interface.

Parameters
int$slot
Return values
bool

◆ offsetGet()

question_attempt_iterator::offsetGet ( $slot)

Standard part of the ArrayAccess interface.

Parameters
int$slot
Return values
question_attempt

◆ offsetSet()

question_attempt_iterator::offsetSet ( $slot,
$value )

Standard part of the ArrayAccess interface.

Parameters
int$slot
question_attempt$value

◆ offsetUnset()

question_attempt_iterator::offsetUnset ( $slot)

Standard part of the ArrayAccess interface.

Parameters
int$slot

◆ valid()

question_attempt_iterator::valid ( )

Standard part of the Iterator interface.

Return values
bool

The documentation for this class was generated from the following file: