Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Attributes | List of all members
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(). More...
 
 current ()
 Standard part of the Iterator interface. More...
 
 key ()
 Standard part of the Iterator interface. More...
 
 next ()
 Standard part of the Iterator interface.
 
 offsetExists ($slot)
 Standard part of the ArrayAccess interface. More...
 
 offsetGet ($slot)
 Standard part of the ArrayAccess interface. More...
 
 offsetSet ($slot, $value)
 Standard part of the ArrayAccess interface. More...
 
 offsetUnset ($slot)
 Standard part of the ArrayAccess interface. More...
 
 rewind ()
 Standard part of the Iterator interface.
 
 valid ()
 Standard part of the Iterator interface. More...
 

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: