ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
assAnswerMatchingPair Class Reference

Class for matching question pairs. More...

+ Inheritance diagram for assAnswerMatchingPair:
+ Collaboration diagram for assAnswerMatchingPair:

Public Member Functions

 __construct (assAnswerMatchingTerm $term, assAnswerMatchingDefinition $definition, float $points=0.0)
 
 getTerm ()
 
 withTerm (assAnswerMatchingTerm $term)
 
 getDefinition ()
 
 withDefinition (assAnswerMatchingDefinition $definition)
 
 getPoints ()
 
 withPoints (float $points)
 
 toNormalized (Transformations $transformations, array $context=[])
 Convert the internal state of the implementing object into a language-neutral array structure. More...
 
 fromNormalized (array $normalized, Transformations $transformations)
 Restore the object from its normalized representation. More...
 
 toNormalized (Transformations $transformations, array $context=[])
 Convert the internal state of the implementing object into a language-neutral array structure. More...
 
 fromNormalized (array $normalized, Transformations $transformations)
 Restore the object from its normalized representation. More...
 

Protected Attributes

assAnswerMatchingTerm $term
 
assAnswerMatchingDefinition $definition
 
float $points
 

Detailed Description

Class for matching question pairs.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m \

Definition at line 31 of file class.assAnswerMatchingPair.php.

Constructor & Destructor Documentation

◆ __construct()

assAnswerMatchingPair::__construct ( assAnswerMatchingTerm  $term,
assAnswerMatchingDefinition  $definition,
float  $points = 0.0 
)

Definition at line 37 of file class.assAnswerMatchingPair.php.

41 {
42 $this->term = $term;
43 $this->definition = $definition;
44 $this->points = $points;
45 }
assAnswerMatchingDefinition $definition

References $definition, $points, and $term.

Member Function Documentation

◆ fromNormalized()

assAnswerMatchingPair::fromNormalized ( array  $normalized,
Transformations  $transformations 
)

Restore the object from its normalized representation.

Parameters
array<array-key,mixed>$normalized

Implements ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\FromNormalized.

Definition at line 94 of file class.assAnswerMatchingPair.php.

97 : self
98 {
99 return $this->withPoints($transformations->float($normalized['points']))
100 ->withTerm($transformations->denormalize($normalized['term'], $this->term))
101 ->withDefinition($transformations->denormalize($normalized['definition'], $this->definition));
102 }
denormalize(array|float|bool|int|string|null $normalized, string|object $expected)

References ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\denormalize(), ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\float(), and withPoints().

+ Here is the call graph for this function:

◆ getDefinition()

assAnswerMatchingPair::getDefinition ( )

Definition at line 58 of file class.assAnswerMatchingPair.php.

59 {
60 return $this->definition;
61 }
Class for matching question definitions.

References $definition.

Referenced by assMatchingQuestion\getCorrectSolutionForTextOutput().

+ Here is the caller graph for this function:

◆ getPoints()

assAnswerMatchingPair::getPoints ( )

Definition at line 69 of file class.assAnswerMatchingPair.php.

69 : float
70 {
71 return $this->points;
72 }

References $points.

◆ getTerm()

assAnswerMatchingPair::getTerm ( )

Definition at line 47 of file class.assAnswerMatchingPair.php.

48 {
49 return $this->term;
50 }
Class for matching question terms.

References $term.

Referenced by assMatchingQuestion\getCorrectSolutionForTextOutput().

+ Here is the caller graph for this function:

◆ toNormalized()

assAnswerMatchingPair::toNormalized ( Transformations  $transformations,
array  $context = [] 
)

Convert the internal state of the implementing object into a language-neutral array structure.

The resulting array must contain only null, scalar values (string, int, float, bool) and nested arrays following the same rules.

Parameters
array<string,mixed>$context
Returns
array<array-key, mixed>|float|bool|int|string|null

Implements ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\ToNormalized.

Definition at line 81 of file class.assAnswerMatchingPair.php.

84 : array|float|bool|int|string|null
85 {
86 return [
87 'points' => $this->points,
88 'term' => $transformations->normalize($this->term, $context),
89 'definition' => $transformations->normalize($this->definition, $context),
90 ];
91 }

References $points, and ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\normalize().

+ Here is the call graph for this function:

◆ withDefinition()

assAnswerMatchingPair::withDefinition ( assAnswerMatchingDefinition  $definition)

Definition at line 62 of file class.assAnswerMatchingPair.php.

62 : self
63 {
64 $clone = clone $this;
65 $clone->definition = $definition;
66 return $clone;
67 }

References $definition.

◆ withPoints()

assAnswerMatchingPair::withPoints ( float  $points)

Definition at line 73 of file class.assAnswerMatchingPair.php.

73 : self
74 {
75 $clone = clone $this;
76 $clone->points = $points;
77 return $clone;
78 }

References $points.

Referenced by fromNormalized().

+ Here is the caller graph for this function:

◆ withTerm()

assAnswerMatchingPair::withTerm ( assAnswerMatchingTerm  $term)

Definition at line 51 of file class.assAnswerMatchingPair.php.

51 : self
52 {
53 $clone = clone $this;
54 $clone->term = $term;
55 return $clone;
56 }

References $term.

Field Documentation

◆ $definition

assAnswerMatchingDefinition assAnswerMatchingPair::$definition
protected

Definition at line 34 of file class.assAnswerMatchingPair.php.

Referenced by __construct(), getDefinition(), and withDefinition().

◆ $points

float assAnswerMatchingPair::$points
protected

Definition at line 35 of file class.assAnswerMatchingPair.php.

Referenced by __construct(), getPoints(), toNormalized(), and withPoints().

◆ $term

assAnswerMatchingTerm assAnswerMatchingPair::$term
protected

Definition at line 33 of file class.assAnswerMatchingPair.php.

Referenced by __construct(), getTerm(), and withTerm().


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