Tsugi

GiftImporter
in package

Parse Moodle GIFT into a format-neutral Quiz1 quiz.

Supported: multiple choice, multiple response, true/false, essay, and short answer (fill in the blank). Numerical and matching items are skipped with a warning. Pattern match is not a GIFT type.

Table of Contents

Methods

import()  : Quiz1, 1: string[]}
unescape()  : mixed
blocks()  : array<string|int, string>
isEscaped()  : mixed
lastBracePair()  : array{0: int, 1: int}|null
oneAnswer()  : array{correct: bool, text: string, feedback: string}|null
parseChoiceAnswers()  : array<int, array{correct: bool, text: string, feedback: string}>
parseQuestion()  : mixed
promptFromGift()  : mixed
snippet()  : mixed
stripBom()  : mixed
trueFalse()  : mixed

Methods

import()

public static import(string $text) : Quiz1, 1: string[]}
Parameters
$text : string
Tags
throws
ImportException
Return values
Quiz1, 1: string[]}

unescape()

public static unescape(mixed $text) : mixed
Parameters
$text : mixed

blocks()

private static blocks(mixed $text) : array<string|int, string>
Parameters
$text : mixed
Return values
array<string|int, string>

isEscaped()

private static isEscaped(mixed $s, mixed $i) : mixed
Parameters
$s : mixed
$i : mixed

lastBracePair()

private static lastBracePair(mixed $text) : array{0: int, 1: int}|null
Parameters
$text : mixed
Return values
array{0: int, 1: int}|null

oneAnswer()

private static oneAnswer(mixed $marker, mixed $raw) : array{correct: bool, text: string, feedback: string}|null
Parameters
$marker : mixed
$raw : mixed
Return values
array{correct: bool, text: string, feedback: string}|null

parseChoiceAnswers()

private static parseChoiceAnswers(mixed $answer) : array<int, array{correct: bool, text: string, feedback: string}>
Parameters
$answer : mixed
Return values
array<int, array{correct: bool, text: string, feedback: string}>

parseQuestion()

private static parseQuestion(mixed $raw, mixed $seq) : mixed
Parameters
$raw : mixed
$seq : mixed
Tags
throws
ImportException

promptFromGift()

private static promptFromGift(mixed $text) : mixed
Parameters
$text : mixed

snippet()

private static snippet(mixed $raw) : mixed
Parameters
$raw : mixed

stripBom()

private static stripBom(mixed $text) : mixed
Parameters
$text : mixed

        
On this page

Search results