repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
oat-sa/qti-sdk | src/qtism/data/content/interactions/Choice.php | Choice.setShowHide | public function setShowHide($showHide)
{
if (in_array($showHide, ShowHide::asArray()) === true) {
$this->showHide = $showHide;
} else {
$msg = "The 'showHide' argument must be a value from the ShowHide enumeration.";
throw new InvalidArgumentException($msg);
... | php | public function setShowHide($showHide)
{
if (in_array($showHide, ShowHide::asArray()) === true) {
$this->showHide = $showHide;
} else {
$msg = "The 'showHide' argument must be a value from the ShowHide enumeration.";
throw new InvalidArgumentException($msg);
... | [
"public",
"function",
"setShowHide",
"(",
"$",
"showHide",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"showHide",
",",
"ShowHide",
"::",
"asArray",
"(",
")",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"showHide",
"=",
"$",
"showHide",
";",
"}",... | Set the visibility of the choice.
@param integer $showHide A value from the ShowHide enumeration.
@throws \InvalidArgumentException If $showHide is not a value from the ShowHide enumeration. | [
"Set",
"the",
"visibility",
"of",
"the",
"choice",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/Choice.php#L212-L220 |
oat-sa/qti-sdk | src/qtism/runtime/storage/binary/LocalQtiBinaryStorage.php | LocalQtiBinaryStorage.persistStream | protected function persistStream(AssessmentTestSession $assessmentTestSession, MemoryStream $stream)
{
$sessionId = $assessmentTestSession->getSessionId();
$path = $this->getPath() . DIRECTORY_SEPARATOR . md5($sessionId) . '.bin';
$written = @file_put_contents($path, $stream->getBinary());
... | php | protected function persistStream(AssessmentTestSession $assessmentTestSession, MemoryStream $stream)
{
$sessionId = $assessmentTestSession->getSessionId();
$path = $this->getPath() . DIRECTORY_SEPARATOR . md5($sessionId) . '.bin';
$written = @file_put_contents($path, $stream->getBinary());
... | [
"protected",
"function",
"persistStream",
"(",
"AssessmentTestSession",
"$",
"assessmentTestSession",
",",
"MemoryStream",
"$",
"stream",
")",
"{",
"$",
"sessionId",
"=",
"$",
"assessmentTestSession",
"->",
"getSessionId",
"(",
")",
";",
"$",
"path",
"=",
"$",
"... | Persist the binary stream $stream which contains the binary equivalent of $assessmentTestSession in
the temporary directory of the file system.
@param \qtism\runtime\tests\AssessmentTestSession $assessmentTestSession The AssessmentTestSession to be persisted.
@param \qtism\common\storage\MemoryStream $stream The Memor... | [
"Persist",
"the",
"binary",
"stream",
"$stream",
"which",
"contains",
"the",
"binary",
"equivalent",
"of",
"$assessmentTestSession",
"in",
"the",
"temporary",
"directory",
"of",
"the",
"file",
"system",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/storage/binary/LocalQtiBinaryStorage.php#L96-L107 |
oat-sa/qti-sdk | src/qtism/runtime/storage/binary/LocalQtiBinaryStorage.php | LocalQtiBinaryStorage.getRetrievalStream | protected function getRetrievalStream($sessionId)
{
$path = $this->getPath() . DIRECTORY_SEPARATOR . md5($sessionId) . '.bin';
$read = @file_get_contents($path);
if ($read === false || strlen($read) === 0) {
$msg = "An error occured while retrieving the binary stream at '${path... | php | protected function getRetrievalStream($sessionId)
{
$path = $this->getPath() . DIRECTORY_SEPARATOR . md5($sessionId) . '.bin';
$read = @file_get_contents($path);
if ($read === false || strlen($read) === 0) {
$msg = "An error occured while retrieving the binary stream at '${path... | [
"protected",
"function",
"getRetrievalStream",
"(",
"$",
"sessionId",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getPath",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"md5",
"(",
"$",
"sessionId",
")",
".",
"'.bin'",
";",
"$",
"read",
"=",
"@",
"fi... | Retrieve the binary representation of the AssessmentTestSession identified by $sessionId which was
instantiated from $assessmentTest from the temporary directory of the file system.
@param string $sessionId The session ID of the AssessmentTestSession to retrieve.
@return \qtism\common\storage\MemoryStream A MemoryStre... | [
"Retrieve",
"the",
"binary",
"representation",
"of",
"the",
"AssessmentTestSession",
"identified",
"by",
"$sessionId",
"which",
"was",
"instantiated",
"from",
"$assessmentTest",
"from",
"the",
"temporary",
"directory",
"of",
"the",
"file",
"system",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/storage/binary/LocalQtiBinaryStorage.php#L117-L129 |
oat-sa/qti-sdk | src/qtism/data/expressions/operators/Operator.php | Operator.setMinOperands | public function setMinOperands($minOperands)
{
if (is_int($minOperands) && $minOperands >= 0) {
$this->minOperands = $minOperands;
} else {
$msg = "The minOperands argument must be an integer >= 0, '" . $minOperands . "' given.";
throw new InvalidArgumentException... | php | public function setMinOperands($minOperands)
{
if (is_int($minOperands) && $minOperands >= 0) {
$this->minOperands = $minOperands;
} else {
$msg = "The minOperands argument must be an integer >= 0, '" . $minOperands . "' given.";
throw new InvalidArgumentException... | [
"public",
"function",
"setMinOperands",
"(",
"$",
"minOperands",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"minOperands",
")",
"&&",
"$",
"minOperands",
">=",
"0",
")",
"{",
"$",
"this",
"->",
"minOperands",
"=",
"$",
"minOperands",
";",
"}",
"else",
"{... | Set the minimum operands count for this Operator.
@param int $minOperands An integer which is >= 0.
@throws \InvalidArgumentException If $minOperands is not an integer >= 0. | [
"Set",
"the",
"minimum",
"operands",
"count",
"for",
"this",
"Operator",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/expressions/operators/Operator.php#L133-L141 |
oat-sa/qti-sdk | src/qtism/data/expressions/operators/Operator.php | Operator.setMaxOperands | public function setMaxOperands($maxOperands)
{
if (is_int($maxOperands)) {
$this->maxOperands = $maxOperands;
} else {
$msg = "The maxOperands argument must be an integer, '" . gettype($maxOperands) . "' given.";
throw new InvalidArgumentException($msg);
}... | php | public function setMaxOperands($maxOperands)
{
if (is_int($maxOperands)) {
$this->maxOperands = $maxOperands;
} else {
$msg = "The maxOperands argument must be an integer, '" . gettype($maxOperands) . "' given.";
throw new InvalidArgumentException($msg);
}... | [
"public",
"function",
"setMaxOperands",
"(",
"$",
"maxOperands",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"maxOperands",
")",
")",
"{",
"$",
"this",
"->",
"maxOperands",
"=",
"$",
"maxOperands",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The maxOperands ... | Set the maxmimum operands count for this Operator. The value
is -1 if unlimited.
@param int $maxOperands
@throws \InvalidArgumentException If $maxOperands is not an integer. | [
"Set",
"the",
"maxmimum",
"operands",
"count",
"for",
"this",
"Operator",
".",
"The",
"value",
"is",
"-",
"1",
"if",
"unlimited",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/expressions/operators/Operator.php#L160-L168 |
oat-sa/qti-sdk | src/qtism/data/expressions/operators/Operator.php | Operator.setAcceptedCardinalities | public function setAcceptedCardinalities(array $acceptedCardinalities)
{
foreach ($acceptedCardinalities as $cardinality) {
if (!in_array($cardinality, OperatorCardinality::asArray(), true)) {
$msg = "Accepted cardinalities must be values from the Cardinality enumeration, '" . $c... | php | public function setAcceptedCardinalities(array $acceptedCardinalities)
{
foreach ($acceptedCardinalities as $cardinality) {
if (!in_array($cardinality, OperatorCardinality::asArray(), true)) {
$msg = "Accepted cardinalities must be values from the Cardinality enumeration, '" . $c... | [
"public",
"function",
"setAcceptedCardinalities",
"(",
"array",
"$",
"acceptedCardinalities",
")",
"{",
"foreach",
"(",
"$",
"acceptedCardinalities",
"as",
"$",
"cardinality",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"cardinality",
",",
"OperatorCardinality... | Set the accepted operand cardinalities.
@param array $acceptedCardinalities An array of values from the Cardinality enumeration.
@throws \InvalidArgumentException If a value from $acceptedCardinalities is not a value from the Cardinality enumeration. | [
"Set",
"the",
"accepted",
"operand",
"cardinalities",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/expressions/operators/Operator.php#L197-L207 |
oat-sa/qti-sdk | src/qtism/data/expressions/operators/Operator.php | Operator.setAcceptedBaseTypes | public function setAcceptedBaseTypes(array $acceptedBaseTypes)
{
foreach ($acceptedBaseTypes as $baseType) {
if (!in_array($baseType, OperatorBaseType::asArray(), true)) {
$msg = "Accepted baseTypes must be values from the OperatorBaseType enumeration, '" . $baseType . "' given."... | php | public function setAcceptedBaseTypes(array $acceptedBaseTypes)
{
foreach ($acceptedBaseTypes as $baseType) {
if (!in_array($baseType, OperatorBaseType::asArray(), true)) {
$msg = "Accepted baseTypes must be values from the OperatorBaseType enumeration, '" . $baseType . "' given."... | [
"public",
"function",
"setAcceptedBaseTypes",
"(",
"array",
"$",
"acceptedBaseTypes",
")",
"{",
"foreach",
"(",
"$",
"acceptedBaseTypes",
"as",
"$",
"baseType",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"baseType",
",",
"OperatorBaseType",
"::",
"asArray... | Set the accepted operand accepted baseTypes.
@param array $acceptedBaseTypes An array of values from the OperatorBaseType enumeration.
@throws \InvalidArgumentException If a value from the $acceptedBaseTypes is not a value from the OperatorBaseType. | [
"Set",
"the",
"accepted",
"operand",
"accepted",
"baseTypes",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/expressions/operators/Operator.php#L225-L235 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/StringMatchProcessor.php | StringMatchProcessor.process | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The StringMatch operator only accepts operands with a single cardinality.";
... | php | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The StringMatch operator only accepts operands with a single cardinality.";
... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"if",
"(",
"$",
"operands",
"->",
"containsNull",
"(",
")",
"===",
"true",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
... | Process the StringMatch operator.
@return boolean Whether the two string match according to the comparison rules of the operator's attributes or NULL if either of the sub-expressions is NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException | [
"Process",
"the",
"StringMatch",
"operator",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/StringMatchProcessor.php#L55-L81 |
oat-sa/qti-sdk | src/qtism/common/utils/Reflection.php | Reflection.newInstance | static public function newInstance(ReflectionClass $class, $args = array())
{
if (empty($args) === true) {
$fqName = $class->getName();
return new $fqName();
} else {
return $class->newInstanceArgs($args);
}
} | php | static public function newInstance(ReflectionClass $class, $args = array())
{
if (empty($args) === true) {
$fqName = $class->getName();
return new $fqName();
} else {
return $class->newInstanceArgs($args);
}
} | [
"static",
"public",
"function",
"newInstance",
"(",
"ReflectionClass",
"$",
"class",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"args",
")",
"===",
"true",
")",
"{",
"$",
"fqName",
"=",
"$",
"class",
"->",
"ge... | An abstraction of the call to ReflectionClass::newInstanceArgs. The main
goal of this method is to avoid to encounter the issue with empty $args
argument described at: http://www.php.net/manual/en/reflectionclass.newinstanceargs.php#99517
@param \ReflectionClass $class
@param array $args
@return mixed An instance of $... | [
"An",
"abstraction",
"of",
"the",
"call",
"to",
"ReflectionClass",
"::",
"newInstanceArgs",
".",
"The",
"main",
"goal",
"of",
"this",
"method",
"is",
"to",
"avoid",
"to",
"encounter",
"the",
"issue",
"with",
"empty",
"$args",
"argument",
"described",
"at",
"... | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/utils/Reflection.php#L47-L56 |
oat-sa/qti-sdk | src/qtism/common/utils/Reflection.php | Reflection.shortClassName | static public function shortClassName($object)
{
$shortClassName = false;
if (is_object($object) === true) {
$parts = explode("\\", get_class($object));
$shortClassName = array_pop($parts);
} elseif (is_string($object) === true && empty($object) === false) {
... | php | static public function shortClassName($object)
{
$shortClassName = false;
if (is_object($object) === true) {
$parts = explode("\\", get_class($object));
$shortClassName = array_pop($parts);
} elseif (is_string($object) === true && empty($object) === false) {
... | [
"static",
"public",
"function",
"shortClassName",
"(",
"$",
"object",
")",
"{",
"$",
"shortClassName",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"object",
")",
"===",
"true",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"\"\\\\\"",
",",
"get... | Obtains the short class name of a given $object.
If $object is not an object, false is returned instead of a string.
Examples:
+ my\namespace\A -> A
+ A -> A
+ \my\A -> A
@param mixed $object An object or a fully qualified class name.
@return boolean|string A short class name or false if $object is not an object no... | [
"Obtains",
"the",
"short",
"class",
"name",
"of",
"a",
"given",
"$object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/utils/Reflection.php#L72-L86 |
oat-sa/qti-sdk | src/qtism/common/utils/Reflection.php | Reflection.isInstanceOf | static public function isInstanceOf($object, $className)
{
$givenType = get_class($object);
return $givenType === $className || is_subclass_of($givenType, $className) === true || in_array($className, class_implements($givenType)) === true;
} | php | static public function isInstanceOf($object, $className)
{
$givenType = get_class($object);
return $givenType === $className || is_subclass_of($givenType, $className) === true || in_array($className, class_implements($givenType)) === true;
} | [
"static",
"public",
"function",
"isInstanceOf",
"(",
"$",
"object",
",",
"$",
"className",
")",
"{",
"$",
"givenType",
"=",
"get_class",
"(",
"$",
"object",
")",
";",
"return",
"$",
"givenType",
"===",
"$",
"className",
"||",
"is_subclass_of",
"(",
"$",
... | Whether or not a given $object is an instance of $className. This method
exists because is_sublcass_of() does not take into account interfaces
in PHP 5.3.
@param mixed $object The object you want to know it is an instance of $className.
@param string $className A class name. It can be fully qualified.
@return boolean | [
"Whether",
"or",
"not",
"a",
"given",
"$object",
"is",
"an",
"instance",
"of",
"$className",
".",
"This",
"method",
"exists",
"because",
"is_sublcass_of",
"()",
"does",
"not",
"take",
"into",
"account",
"interfaces",
"in",
"PHP",
"5",
".",
"3",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/utils/Reflection.php#L97-L102 |
oat-sa/qti-sdk | src/qtism/common/datatypes/QtiDirectedPair.php | QtiDirectedPair.equals | public function equals($obj)
{
if (gettype($obj) === 'object' && $obj instanceof self) {
return $obj->getFirst() === $this->getFirst() && $obj->getSecond() === $this->getSecond();
}
return false;
} | php | public function equals($obj)
{
if (gettype($obj) === 'object' && $obj instanceof self) {
return $obj->getFirst() === $this->getFirst() && $obj->getSecond() === $this->getSecond();
}
return false;
} | [
"public",
"function",
"equals",
"(",
"$",
"obj",
")",
"{",
"if",
"(",
"gettype",
"(",
"$",
"obj",
")",
"===",
"'object'",
"&&",
"$",
"obj",
"instanceof",
"self",
")",
"{",
"return",
"$",
"obj",
"->",
"getFirst",
"(",
")",
"===",
"$",
"this",
"->",
... | Whether or not $obj is equal to $this. Two DirectedPair objects
are considered to be equal if their first and second values are the same.
@return boolean | [
"Whether",
"or",
"not",
"$obj",
"is",
"equal",
"to",
"$this",
".",
"Two",
"DirectedPair",
"objects",
"are",
"considered",
"to",
"be",
"equal",
"if",
"their",
"first",
"and",
"second",
"values",
"are",
"the",
"same",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/QtiDirectedPair.php#L45-L52 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/OrProcessor.php | OrProcessor.process | public function process()
{
$operands = $this->getOperands();
$allFalse = true;
foreach ($operands as $op) {
if ($op instanceof Container) {
$msg = "The Or Expression only accept operands with single cardinality.";
throw new OperatorProcessingExce... | php | public function process()
{
$operands = $this->getOperands();
$allFalse = true;
foreach ($operands as $op) {
if ($op instanceof Container) {
$msg = "The Or Expression only accept operands with single cardinality.";
throw new OperatorProcessingExce... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"$",
"allFalse",
"=",
"true",
";",
"foreach",
"(",
"$",
"operands",
"as",
"$",
"op",
")",
"{",
"if",
"(",
"$",
"op",
"instanceof"... | Process the current expression.
@return boolean True if the expression is true, false otherwise.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException | [
"Process",
"the",
"current",
"expression",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/OrProcessor.php#L54-L88 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/AssessmentItemRefMarshaller.php | AssessmentItemRefMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = parent::marshall($component);
$this->setDOMElementAttribute($element, 'href', $component->getHref());
// Deal with categories.
$categories = $component->getCategories();
if (count($categories) > 0) {
... | php | protected function marshall(QtiComponent $component)
{
$element = parent::marshall($component);
$this->setDOMElementAttribute($element, 'href', $component->getHref());
// Deal with categories.
$categories = $component->getCategories();
if (count($categories) > 0) {
... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"parent",
"::",
"marshall",
"(",
"$",
"component",
")",
";",
"$",
"this",
"->",
"setDOMElementAttribute",
"(",
"$",
"element",
",",
"'href'",
",",
"$... | Marshall an AssessmentItemRef object into a DOMElement object.
@param \qtism\data\QtiComponent $component An assessmentItemRef object.
@return \DOMElement The according DOMElement object.
@throws \qtism\data\storage\xml\marshalling\MarshallingException | [
"Marshall",
"an",
"AssessmentItemRef",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/AssessmentItemRefMarshaller.php#L48-L82 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/AssessmentItemRefMarshaller.php | AssessmentItemRefMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
$baseComponent = parent::unmarshall($element);
if (($href = $this->getDOMElementAttributeAs($element, 'href')) !== null) {
$object = new AssessmentItemRef($baseComponent->getIdentifier(), $href);
$object->setRequired($base... | php | protected function unmarshall(DOMElement $element)
{
$baseComponent = parent::unmarshall($element);
if (($href = $this->getDOMElementAttributeAs($element, 'href')) !== null) {
$object = new AssessmentItemRef($baseComponent->getIdentifier(), $href);
$object->setRequired($base... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"baseComponent",
"=",
"parent",
"::",
"unmarshall",
"(",
"$",
"element",
")",
";",
"if",
"(",
"(",
"$",
"href",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"("... | Unmarshall a DOMElement object corresponding to a QTI assessmentItemRef element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent An AssessmentItemRef object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException If the mandatory attribute 'href' is missing. | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"assessmentItemRef",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/AssessmentItemRefMarshaller.php#L91-L141 |
oat-sa/qti-sdk | src/qtism/data/expressions/RandomInteger.php | RandomInteger.setMin | public function setMin($min)
{
if (is_int($min) || Format::isVariableRef($max)) {
$this->min = $min;
} else {
$msg = "'Min' must be an integer, '" . gettype($min) . "' given.";
throw new InvalidArgumentException($msg);
}
} | php | public function setMin($min)
{
if (is_int($min) || Format::isVariableRef($max)) {
$this->min = $min;
} else {
$msg = "'Min' must be an integer, '" . gettype($min) . "' given.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setMin",
"(",
"$",
"min",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"min",
")",
"||",
"Format",
"::",
"isVariableRef",
"(",
"$",
"max",
")",
")",
"{",
"$",
"this",
"->",
"min",
"=",
"$",
"min",
";",
"}",
"else",
"{",
"$",
... | Set the value of the min attribute.
@param integer $min
@throws \InvalidArgumentException | [
"Set",
"the",
"value",
"of",
"the",
"min",
"attribute",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/expressions/RandomInteger.php#L94-L102 |
oat-sa/qti-sdk | src/qtism/data/expressions/RandomInteger.php | RandomInteger.setStep | public function setStep($step)
{
if (is_int($step)) {
$this->step = $step;
} else {
$msg = "'Step' must be an integer, '" . gettype($step) . "' given.";
throw new InvalidArgumentException($msg);
}
} | php | public function setStep($step)
{
if (is_int($step)) {
$this->step = $step;
} else {
$msg = "'Step' must be an integer, '" . gettype($step) . "' given.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setStep",
"(",
"$",
"step",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"step",
")",
")",
"{",
"$",
"this",
"->",
"step",
"=",
"$",
"step",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"'Step' must be an integer, '\"",
".",
"gettype"... | Set the value of the step attribute.
@param integer $step
@throws \InvalidArgumentException | [
"Set",
"the",
"value",
"of",
"the",
"step",
"attribute",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/expressions/RandomInteger.php#L146-L154 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/Param.php | Param.setName | public function setName($name)
{
if (is_string($name) === true) {
$this->name = $name;
} else {
$msg = "The 'name' argument must be a string, '" . gettype($name) . "' given.";
throw new InvalidArgumentException($msg);
}
} | php | public function setName($name)
{
if (is_string($name) === true) {
$this->name = $name;
} else {
$msg = "The 'name' argument must be a string, '" . gettype($name) . "' given.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"name",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The 'name' argument must be a... | Set the name of the parameter, as interpreted by the object.
@param string $name A string.
@throws \InvalidArgumentException If $name is not a string. | [
"Set",
"the",
"name",
"of",
"the",
"parameter",
"as",
"interpreted",
"by",
"the",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/Param.php#L116-L124 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/Param.php | Param.setValue | public function setValue($value)
{
if (is_string($value) === true) {
$this->value = $value;
} else {
$msg = "The 'value' argument must be a string, '" . gettype($value) . "' given.";
throw new InvalidArgumentException($msg);
}
} | php | public function setValue($value)
{
if (is_string($value) === true) {
$this->value = $value;
} else {
$msg = "The 'value' argument must be a string, '" . gettype($value) . "' given.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"$",
"value",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The 'value' argument mus... | Set the value to pass to the object for the named parameter.
@param string $value A value as a string.
@throws \InvalidArgumentException If $value is not a string. | [
"Set",
"the",
"value",
"to",
"pass",
"to",
"the",
"object",
"for",
"the",
"named",
"parameter",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/Param.php#L142-L150 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/Param.php | Param.setValueType | public function setValueType($valueType)
{
if (in_array($valueType, ParamType::asArray(), true) === true) {
$this->valueType = $valueType;
} else {
$msg = "The 'valueType' argument must be a value from the ParamType enumeration, '" . gettype($valueType) . "' given.";
... | php | public function setValueType($valueType)
{
if (in_array($valueType, ParamType::asArray(), true) === true) {
$this->valueType = $valueType;
} else {
$msg = "The 'valueType' argument must be a value from the ParamType enumeration, '" . gettype($valueType) . "' given.";
... | [
"public",
"function",
"setValueType",
"(",
"$",
"valueType",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"valueType",
",",
"ParamType",
"::",
"asArray",
"(",
")",
",",
"true",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"valueType",
"=",
"$",
"va... | Set the valueType attribute.
@param integer $valueType A value from the ParamType enumeration.
@throws \InvalidArgumentException If $valueType is not a value from the ParamType enumeration. | [
"Set",
"the",
"valueType",
"attribute",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/Param.php#L168-L176 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/SelectionMarshaller.php | SelectionMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'select', $component->getSelect());
$this->setDOMElementAttribute($element, 'withReplacement', $component->isWithRe... | php | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'select', $component->getSelect());
$this->setDOMElementAttribute($element, 'withReplacement', $component->isWithRe... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"static",
"::",
"getDOMCradle",
"(",
")",
"->",
"createElement",
"(",
"$",
"component",
"->",
"getQtiClassName",
"(",
")",
")",
";",
"$",
"this",
"->... | Marshall a Selection object into a DOMElement object.
@param \qtism\data\QtiComponent $component A Selection object.
@return \DOMElement The according DOMElement object. | [
"Marshall",
"a",
"Selection",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/SelectionMarshaller.php#L44-L59 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/SelectionMarshaller.php | SelectionMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
// Retrieve XML content as a string.
$frag = $element->ownerDocument->createDocumentFragment();
$element = $element->cloneNode(true);
$frag->appendChild($element);
$xmlString = $frag->ownerDocument->saveXML($frag);
... | php | protected function unmarshall(DOMElement $element)
{
// Retrieve XML content as a string.
$frag = $element->ownerDocument->createDocumentFragment();
$element = $element->cloneNode(true);
$frag->appendChild($element);
$xmlString = $frag->ownerDocument->saveXML($frag);
... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"// Retrieve XML content as a string.",
"$",
"frag",
"=",
"$",
"element",
"->",
"ownerDocument",
"->",
"createDocumentFragment",
"(",
")",
";",
"$",
"element",
"=",
"$",
"element",... | Unmarshall a DOMElement object corresponding to a QTI Selection object.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A Selection object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException If the mandatory 'select' attribute is missing from $element. | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"Selection",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/SelectionMarshaller.php#L68-L92 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/qtipl/rules/BranchRuleQtiPLRenderer.php | BranchRuleQtiPLRenderer.render | public function render($something)
{
$renderer = new QtiPLRenderer($this->getCRO());
$attributes = [];
$attributes['target'] = "\"" . $something->getTarget() . "\"";
return $something->getQtiClassName() . $renderer->writeAttributes($attributes)
. $renderer->writeChildEle... | php | public function render($something)
{
$renderer = new QtiPLRenderer($this->getCRO());
$attributes = [];
$attributes['target'] = "\"" . $something->getTarget() . "\"";
return $something->getQtiClassName() . $renderer->writeAttributes($attributes)
. $renderer->writeChildEle... | [
"public",
"function",
"render",
"(",
"$",
"something",
")",
"{",
"$",
"renderer",
"=",
"new",
"QtiPLRenderer",
"(",
"$",
"this",
"->",
"getCRO",
"(",
")",
")",
";",
"$",
"attributes",
"=",
"[",
"]",
";",
"$",
"attributes",
"[",
"'target'",
"]",
"=",
... | Render a QtiComponent object into another constitution.
@param mixed $something Something to render into another consitution.
@return mixed The rendered component into another constitution.
@throws \qtism\runtime\rendering\RenderingException If something goes wrong while rendering the component. | [
"Render",
"a",
"QtiComponent",
"object",
"into",
"another",
"constitution",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/qtipl/rules/BranchRuleQtiPLRenderer.php#L45-L53 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/InterpolationTableEntryMarshaller.php | InterpolationTableEntryMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
if (($sourceValue = $this->getDOMElementAttributeAs($element, 'sourceValue', 'float')) !== null) {
if (($targetValue = $this->getDOMElementAttributeAs($element, 'targetValue', 'string')) !== null) {
$object = new Interpolation... | php | protected function unmarshall(DOMElement $element)
{
if (($sourceValue = $this->getDOMElementAttributeAs($element, 'sourceValue', 'float')) !== null) {
if (($targetValue = $this->getDOMElementAttributeAs($element, 'targetValue', 'string')) !== null) {
$object = new Interpolation... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"if",
"(",
"(",
"$",
"sourceValue",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'sourceValue'",
",",
"'float'",
")",
")",
"!==",
"null",
... | Unmarshall a DOMElement object corresponding to a QTI InterpolationEntry element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent An InterpolationTableEntry object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"InterpolationEntry",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/InterpolationTableEntryMarshaller.php#L107-L124 |
oat-sa/qti-sdk | src/qtism/data/QtiComponentCollection.php | QtiComponentCollection.exclusivelyContainsComponentsWithClassName | public function exclusivelyContainsComponentsWithClassName($className, $recursive = true)
{
$data = $this->getDataPlaceHolder();
foreach ($data as $component) {
if ($component->getQtiClassName() !== $className) {
return false;
} else if ($recu... | php | public function exclusivelyContainsComponentsWithClassName($className, $recursive = true)
{
$data = $this->getDataPlaceHolder();
foreach ($data as $component) {
if ($component->getQtiClassName() !== $className) {
return false;
} else if ($recu... | [
"public",
"function",
"exclusivelyContainsComponentsWithClassName",
"(",
"$",
"className",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"compon... | Whether the collection contains exclusively QtiComponent objects having a given $className.
@param string $className A QTI class name.
@param boolean $recursive Wether to check children QtiComponent objects.
@return boolean | [
"Whether",
"the",
"collection",
"contains",
"exclusively",
"QtiComponent",
"objects",
"having",
"a",
"given",
"$className",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/QtiComponentCollection.php#L85-L103 |
oat-sa/qti-sdk | src/qtism/runtime/common/State.php | State.setVariable | public function setVariable(Variable $variable)
{
$this->checkType($variable);
$data = &$this->getDataPlaceHolder();
$data[$variable->getIdentifier()] = $variable;
} | php | public function setVariable(Variable $variable)
{
$this->checkType($variable);
$data = &$this->getDataPlaceHolder();
$data[$variable->getIdentifier()] = $variable;
} | [
"public",
"function",
"setVariable",
"(",
"Variable",
"$",
"variable",
")",
"{",
"$",
"this",
"->",
"checkType",
"(",
"$",
"variable",
")",
";",
"$",
"data",
"=",
"&",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
";",
"$",
"data",
"[",
"$",
"va... | Set a variable to the state. It will be accessible by it's variable name.
@param \qtism\runtime\common\Variable $variable | [
"Set",
"a",
"variable",
"to",
"the",
"state",
".",
"It",
"will",
"be",
"accessible",
"by",
"it",
"s",
"variable",
"name",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/State.php#L67-L72 |
oat-sa/qti-sdk | src/qtism/runtime/common/State.php | State.getVariable | public function getVariable($variableIdentifier)
{
$data = &$this->getDataPlaceHolder();
if (isset($data[$variableIdentifier])) {
return $data[$variableIdentifier];
} else {
return null;
}
} | php | public function getVariable($variableIdentifier)
{
$data = &$this->getDataPlaceHolder();
if (isset($data[$variableIdentifier])) {
return $data[$variableIdentifier];
} else {
return null;
}
} | [
"public",
"function",
"getVariable",
"(",
"$",
"variableIdentifier",
")",
"{",
"$",
"data",
"=",
"&",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"$",
"variableIdentifier",
"]",
")",
")",
"{",
"ret... | Get a variable with the identifier $variableIdentifier.
@param string $variableIdentifier A QTI identifier.
@return \qtism\runtime\common\Variable A Variable object or null if the $variableIdentifier does not match any Variable object stored in the State. | [
"Get",
"a",
"variable",
"with",
"the",
"identifier",
"$variableIdentifier",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/State.php#L80-L88 |
oat-sa/qti-sdk | src/qtism/runtime/common/State.php | State.unsetVariable | public function unsetVariable($variable)
{
$data = &$this->getDataPlaceHolder();
if (gettype($variable) === 'string') {
$variableIdentifier = $variable;
} elseif ($variable instanceof Variable) {
$variableIdentifier = $variable->getIdentifier();
} else {
... | php | public function unsetVariable($variable)
{
$data = &$this->getDataPlaceHolder();
if (gettype($variable) === 'string') {
$variableIdentifier = $variable;
} elseif ($variable instanceof Variable) {
$variableIdentifier = $variable->getIdentifier();
} else {
... | [
"public",
"function",
"unsetVariable",
"(",
"$",
"variable",
")",
"{",
"$",
"data",
"=",
"&",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
";",
"if",
"(",
"gettype",
"(",
"$",
"variable",
")",
"===",
"'string'",
")",
"{",
"$",
"variableIdentifier",... | Unset a variable from the current state. In other words
the relevant Variable object is removed from the state.
@param string|Variable $variable The identifier of the variable or a Variable object to unset.
@throws \InvalidArgumentException If $variable is not a string nor a Variable object.
@throws \OutOfBoundsExcept... | [
"Unset",
"a",
"variable",
"from",
"the",
"current",
"state",
".",
"In",
"other",
"words",
"the",
"relevant",
"Variable",
"object",
"is",
"removed",
"from",
"the",
"state",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/State.php#L108-L127 |
oat-sa/qti-sdk | src/qtism/runtime/common/State.php | State.resetOutcomeVariables | public function resetOutcomeVariables($preserveBuiltIn = true)
{
$data = &$this->getDataPlaceHolder();
foreach (array_keys($data) as $k) {
if ($data[$k] instanceof OutcomeVariable) {
if ($preserveBuiltIn === true && $k === 'completionStatus') {
contin... | php | public function resetOutcomeVariables($preserveBuiltIn = true)
{
$data = &$this->getDataPlaceHolder();
foreach (array_keys($data) as $k) {
if ($data[$k] instanceof OutcomeVariable) {
if ($preserveBuiltIn === true && $k === 'completionStatus') {
contin... | [
"public",
"function",
"resetOutcomeVariables",
"(",
"$",
"preserveBuiltIn",
"=",
"true",
")",
"{",
"$",
"data",
"=",
"&",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"data",
")",
"as",
"$",
"k",
")",
... | Reset all outcome variables to their defaults.
@param boolean $preserveBuiltIn Whether the built-in outcome variable 'completionStatus' should be preserved. | [
"Reset",
"all",
"outcome",
"variables",
"to",
"their",
"defaults",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/State.php#L172-L185 |
oat-sa/qti-sdk | src/qtism/runtime/common/State.php | State.resetTemplateVariables | public function resetTemplateVariables()
{
$data = &$this->getDataPlaceHolder();
foreach (array_keys($data) as $k) {
if ($data[$k] instanceof TemplateVariable) {
$data[$k]->applyDefaultValue();
}
}
} | php | public function resetTemplateVariables()
{
$data = &$this->getDataPlaceHolder();
foreach (array_keys($data) as $k) {
if ($data[$k] instanceof TemplateVariable) {
$data[$k]->applyDefaultValue();
}
}
} | [
"public",
"function",
"resetTemplateVariables",
"(",
")",
"{",
"$",
"data",
"=",
"&",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"data",
")",
"as",
"$",
"k",
")",
"{",
"if",
"(",
"$",
"data",
"[",
... | Reset all template variables to their defaults.
@return void | [
"Reset",
"all",
"template",
"variables",
"to",
"their",
"defaults",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/State.php#L192-L201 |
oat-sa/qti-sdk | src/qtism/runtime/common/State.php | State.containsNullOnly | public function containsNullOnly()
{
$data = $this->getDataPlaceHolder();
foreach ($data as $variable) {
$value = $variable->getValue();
if ($variable->isNull() === false) {
return false;
}
}
return tr... | php | public function containsNullOnly()
{
$data = $this->getDataPlaceHolder();
foreach ($data as $variable) {
$value = $variable->getValue();
if ($variable->isNull() === false) {
return false;
}
}
return tr... | [
"public",
"function",
"containsNullOnly",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"variable",
")",
"{",
"$",
"value",
"=",
"$",
"variable",
"->",
"getValue",
"(",
... | Whether or not the State contains NULL only values.
Please note that in QTI terms, empty containers and empty strings are considered
to be NULL as well. Moreover, if the State is empty of any variable, the method
will return true.
@return boolean | [
"Whether",
"or",
"not",
"the",
"State",
"contains",
"NULL",
"only",
"values",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/State.php#L212-L225 |
oat-sa/qti-sdk | src/qtism/runtime/common/State.php | State.containsValuesEqualToVariableDefaultOnly | public function containsValuesEqualToVariableDefaultOnly()
{
$data = $this->getDataPlaceHolder();
foreach ($data as $variable) {
$value = $variable->getValue();
$default = $variable->getDefaultValue();
if (Utils::isNull($value) === true) {
... | php | public function containsValuesEqualToVariableDefaultOnly()
{
$data = $this->getDataPlaceHolder();
foreach ($data as $variable) {
$value = $variable->getValue();
$default = $variable->getDefaultValue();
if (Utils::isNull($value) === true) {
... | [
"public",
"function",
"containsValuesEqualToVariableDefaultOnly",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"variable",
")",
"{",
"$",
"value",
"=",
"$",
"variable",
"->... | Whether or not the State contains only values that are equals to their variable default value only.
@return boolean | [
"Whether",
"or",
"not",
"the",
"State",
"contains",
"only",
"values",
"that",
"are",
"equals",
"to",
"their",
"variable",
"default",
"value",
"only",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/State.php#L232-L250 |
oat-sa/qti-sdk | src/qtism/runtime/processing/TemplateProcessingEngine.php | TemplateProcessingEngine.setComponent | public function setComponent(QtiComponent $templateProcessing)
{
if ($templateProcessing instanceof TemplateProcessing) {
parent::setComponent($templateProcessing);
} else {
$msg = "The TemplateProcessing class only accepts TemplateProcessing objects to be executed.";
... | php | public function setComponent(QtiComponent $templateProcessing)
{
if ($templateProcessing instanceof TemplateProcessing) {
parent::setComponent($templateProcessing);
} else {
$msg = "The TemplateProcessing class only accepts TemplateProcessing objects to be executed.";
... | [
"public",
"function",
"setComponent",
"(",
"QtiComponent",
"$",
"templateProcessing",
")",
"{",
"if",
"(",
"$",
"templateProcessing",
"instanceof",
"TemplateProcessing",
")",
"{",
"parent",
"::",
"setComponent",
"(",
"$",
"templateProcessing",
")",
";",
"}",
"else... | Set the TemplateProcessing object to be executed by the engine depending
on the current context.
@param \qtism\data\QtiComponent $templateProcessing A TemplateProcessing object.
@throws \InvalidArgumentException If $templateProcessing is not A TemplateProcessing object. | [
"Set",
"the",
"TemplateProcessing",
"object",
"to",
"be",
"executed",
"by",
"the",
"engine",
"depending",
"on",
"the",
"current",
"context",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/processing/TemplateProcessingEngine.php#L73-L81 |
oat-sa/qti-sdk | src/qtism/runtime/processing/TemplateProcessingEngine.php | TemplateProcessingEngine.process | public function process()
{
$context = $this->getContext();
$templateProcessing = $this->getComponent();
$trialCount = 0;
// Make a copy of possibly impacted variables.
$impactedVariables = Utils::templateProcessingImpactedVariables($templateProcessing);
... | php | public function process()
{
$context = $this->getContext();
$templateProcessing = $this->getComponent();
$trialCount = 0;
// Make a copy of possibly impacted variables.
$impactedVariables = Utils::templateProcessingImpactedVariables($templateProcessing);
... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
"templateProcessing",
"=",
"$",
"this",
"->",
"getComponent",
"(",
")",
";",
"$",
"trialCount",
"=",
"0",
";",
"// Make a copy of po... | Process the template processing.
@throws \qtism\runtime\common\ProcessingException If an error occurs while executing the TemplateProcessing. | [
"Process",
"the",
"template",
"processing",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/processing/TemplateProcessingEngine.php#L108-L156 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/RandomFloatMarshaller.php | RandomFloatMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
// max attribute is mandatory.
if (($max = $this->getDOMElementAttributeAs($element, 'max')) !== null) {
$max = (Format::isVariableRef($max)) ? $max : floatval($max);
$object = new RandomFloat(0.0, $max);
if (... | php | protected function unmarshall(DOMElement $element)
{
// max attribute is mandatory.
if (($max = $this->getDOMElementAttributeAs($element, 'max')) !== null) {
$max = (Format::isVariableRef($max)) ? $max : floatval($max);
$object = new RandomFloat(0.0, $max);
if (... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"// max attribute is mandatory.",
"if",
"(",
"(",
"$",
"max",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'max'",
")",
")",
"!==",
"null",
... | Unmarshall a DOMElement object corresponding to a QTI randomFloat element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A RandomFloat object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException If the mandatory attributes min or max ar missing. | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"randomFloat",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/RandomFloatMarshaller.php#L61-L79 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/MathConstantProcessor.php | MathConstantProcessor.process | public function process()
{
$expr = $this->getExpression();
if ($expr->getName() === MathEnumeration::E) {
return new QtiFloat(M_E);
} else {
return new QtiFloat(M_PI);
}
} | php | public function process()
{
$expr = $this->getExpression();
if ($expr->getName() === MathEnumeration::E) {
return new QtiFloat(M_E);
} else {
return new QtiFloat(M_PI);
}
} | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"expr",
"=",
"$",
"this",
"->",
"getExpression",
"(",
")",
";",
"if",
"(",
"$",
"expr",
"->",
"getName",
"(",
")",
"===",
"MathEnumeration",
"::",
"E",
")",
"{",
"return",
"new",
"QtiFloat",
"(",
... | Process the MathConstant Expression.
@return float A float value (e or pi). | [
"Process",
"the",
"MathConstant",
"Expression",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/MathConstantProcessor.php#L48-L56 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/custom/Explode.php | Explode.process | public function process()
{
$operands = $this->getOperands();
if (($c = count($operands)) < 2) {
$msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator takes 2 sub-expressions as parameters, ${c} given.";
throw new OperatorProcessingException($msg, ... | php | public function process()
{
$operands = $this->getOperands();
if (($c = count($operands)) < 2) {
$msg = "The 'qtism.runtime.expressions.operators.custom.Explode' custom operator takes 2 sub-expressions as parameters, ${c} given.";
throw new OperatorProcessingException($msg, ... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"if",
"(",
"(",
"$",
"c",
"=",
"count",
"(",
"$",
"operands",
")",
")",
"<",
"2",
")",
"{",
"$",
"msg",
"=",
"\"The 'qtism.runt... | Process the expression by implementing PHP core's explode function.
@return \qtism\runtime\common\OrderedContainer The split value of the second sub-expression given as a parameter.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException If something goes wrong. | [
"Process",
"the",
"expression",
"by",
"implementing",
"PHP",
"core",
"s",
"explode",
"function",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/custom/Explode.php#L59-L88 |
oat-sa/qti-sdk | src/qtism/data/content/FeedbackBlock.php | FeedbackBlock.setOutcomeIdentifier | public function setOutcomeIdentifier($outcomeIdentifier)
{
if (Format::isIdentifier($outcomeIdentifier, false) === true) {
$this->outcomeIdentifier = $outcomeIdentifier;
} else {
$msg = "The 'outcomeIdentifier' argument must be a valid QTI identifier, '" . $outcomeIdentifier ... | php | public function setOutcomeIdentifier($outcomeIdentifier)
{
if (Format::isIdentifier($outcomeIdentifier, false) === true) {
$this->outcomeIdentifier = $outcomeIdentifier;
} else {
$msg = "The 'outcomeIdentifier' argument must be a valid QTI identifier, '" . $outcomeIdentifier ... | [
"public",
"function",
"setOutcomeIdentifier",
"(",
"$",
"outcomeIdentifier",
")",
"{",
"if",
"(",
"Format",
"::",
"isIdentifier",
"(",
"$",
"outcomeIdentifier",
",",
"false",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"outcomeIdentifier",
"=",
"$",
"ou... | The identifier of an outcome variable ruling the visibility of the feedbackBlock.
@param string $identifier A QTI identifier.
@throws \InvalidArgumentException If $outcomeIdentifier is an invalid identifier. | [
"The",
"identifier",
"of",
"an",
"outcome",
"variable",
"ruling",
"the",
"visibility",
"of",
"the",
"feedbackBlock",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/FeedbackBlock.php#L113-L121 |
oat-sa/qti-sdk | src/qtism/data/content/FeedbackBlock.php | FeedbackBlock.setIdentifier | public function setIdentifier($identifier)
{
if (Format::isIdentifier($identifier, false) === true) {
$this->identifier = $identifier;
} else {
$msg = "The 'identifier' argument must be a valid QTI identifier, '" . $identifier . "' given.";
throw new InvalidArgume... | php | public function setIdentifier($identifier)
{
if (Format::isIdentifier($identifier, false) === true) {
$this->identifier = $identifier;
} else {
$msg = "The 'identifier' argument must be a valid QTI identifier, '" . $identifier . "' given.";
throw new InvalidArgume... | [
"public",
"function",
"setIdentifier",
"(",
"$",
"identifier",
")",
"{",
"if",
"(",
"Format",
"::",
"isIdentifier",
"(",
"$",
"identifier",
",",
"false",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"identifier",
"=",
"$",
"identifier",
";",
"}",
"... | Set the identifier to match in order to show/hide the feedbackBlock.
@param string $identifier A QTI identifier.
@throws \InvalidArgumentException If $identifier is not a valid QTI identifier. | [
"Set",
"the",
"identifier",
"to",
"match",
"in",
"order",
"to",
"show",
"/",
"hide",
"the",
"feedbackBlock",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/FeedbackBlock.php#L166-L174 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/RoundProcessor.php | RoundProcessor.process | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The Round operator only accepts operands with a single cardinality.";
t... | php | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The Round operator only accepts operands with a single cardinality.";
t... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"if",
"(",
"$",
"operands",
"->",
"containsNull",
"(",
")",
"===",
"true",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
... | Process the Round operator.
@return integer|null An integer value formed by rounding the value of the sub-expression or NULL if the sub-expression is NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException | [
"Process",
"the",
"Round",
"operator",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/RoundProcessor.php#L54-L76 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/AssociationValidityConstraintMarshaller.php | AssociationValidityConstraintMarshaller.marshall | public function marshall(QtiComponent $component)
{
$element = self::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
$this->setDOMElementAttribute($element, 'minConstraint', $component->getMinCo... | php | public function marshall(QtiComponent $component)
{
$element = self::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
$this->setDOMElementAttribute($element, 'minConstraint', $component->getMinCo... | [
"public",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"self",
"::",
"getDOMCradle",
"(",
")",
"->",
"createElement",
"(",
"$",
"component",
"->",
"getQtiClassName",
"(",
")",
")",
";",
"$",
"this",
"->",
... | Marshall an AssociationValidityConstraint object to its XML counterpart.
@param \qtism\data\QtiComponent $component
@return \DOMElement | [
"Marshall",
"an",
"AssociationValidityConstraint",
"object",
"to",
"its",
"XML",
"counterpart",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/AssociationValidityConstraintMarshaller.php#L44-L52 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/AssociationValidityConstraintMarshaller.php | AssociationValidityConstraintMarshaller.unmarshall | public function unmarshall(DOMElement $element)
{
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
if (($minConstraint = $this->getDOMElementAttributeAs($element, 'minConstraint', 'integer')) !== null) {
if (($m... | php | public function unmarshall(DOMElement $element)
{
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
if (($minConstraint = $this->getDOMElementAttributeAs($element, 'minConstraint', 'integer')) !== null) {
if (($m... | [
"public",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"if",
"(",
"(",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'identifier'",
")",
")",
"!==",
"null",
")",
"{",
"if",
"("... | Unmarshall a DOMElement to its AssociationValidityConstraint data model representation.
@param \DOMElement $element
@return \qtism\data\QtiComponent An AssociationValidityConstraint object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"to",
"its",
"AssociationValidityConstraint",
"data",
"model",
"representation",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/AssociationValidityConstraintMarshaller.php#L61-L97 |
oat-sa/qti-sdk | src/qtism/data/storage/php/marshalling/PhpCollectionMarshaller.php | PhpCollectionMarshaller.marshall | public function marshall()
{
$collection = $this->getToMarshall();
$ctx = $this->getContext();
$access = $ctx->getStreamAccess();
$valueArray = $collection->getArrayCopy();
$valueArrayVarName = $ctx->generateVariableName($valueArray);
$arrayArgs = new PhpArgumentCol... | php | public function marshall()
{
$collection = $this->getToMarshall();
$ctx = $this->getContext();
$access = $ctx->getStreamAccess();
$valueArray = $collection->getArrayCopy();
$valueArrayVarName = $ctx->generateVariableName($valueArray);
$arrayArgs = new PhpArgumentCol... | [
"public",
"function",
"marshall",
"(",
")",
"{",
"$",
"collection",
"=",
"$",
"this",
"->",
"getToMarshall",
"(",
")",
";",
"$",
"ctx",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
"access",
"=",
"$",
"ctx",
"->",
"getStreamAccess",
"(",... | Marshall AbstractCollection objects into PHP source code.
@throws \qtism\data\storage\php\marshalling\PhpMarshallingException If something wrong happens during marshalling. | [
"Marshall",
"AbstractCollection",
"objects",
"into",
"PHP",
"source",
"code",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/php/marshalling/PhpCollectionMarshaller.php#L44-L78 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/SectionPartMarshaller.php | SectionPartMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
$this->setDOMElementAttribute($element, 'required', $component->isRequi... | php | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
$this->setDOMElementAttribute($element, 'required', $component->isRequi... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"static",
"::",
"getDOMCradle",
"(",
")",
"->",
"createElement",
"(",
"$",
"component",
"->",
"getQtiClassName",
"(",
")",
")",
";",
"$",
"this",
"->... | Marshall a SectionPart object into a DOMElement object.
@param \qtism\data\QtiComponent $component A SectionPart object.
@return \DOMElement The according DOMElement object. | [
"Marshall",
"a",
"SectionPart",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/SectionPartMarshaller.php#L47-L76 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/SectionPartMarshaller.php | SectionPartMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
$object = new SectionPart($identifier);
if (($required = $this->getDOMElementAttributeAs($element, 'required', 'boolean')) !== null) {
... | php | protected function unmarshall(DOMElement $element)
{
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
$object = new SectionPart($identifier);
if (($required = $this->getDOMElementAttributeAs($element, 'required', 'boolean')) !== null) {
... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"if",
"(",
"(",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'identifier'",
")",
")",
"!==",
"null",
")",
"{",
"$",
"... | Unmarshall a DOMElement object corresponding to a QTI sectionPart element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A SectionPart object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"sectionPart",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/SectionPartMarshaller.php#L85-L136 |
oat-sa/qti-sdk | src/qtism/data/storage/LocalFileResolver.php | LocalFileResolver.resolve | public function resolve($url)
{
$baseUrl = Utils::sanitizeUri($this->getBasePath());
$baseDir = pathinfo($baseUrl, PATHINFO_DIRNAME);
if (empty($baseDir)) {
$msg = "The base directory of the document ('${baseDir}') could not be resolved.";
throw new ResolutionExcepti... | php | public function resolve($url)
{
$baseUrl = Utils::sanitizeUri($this->getBasePath());
$baseDir = pathinfo($baseUrl, PATHINFO_DIRNAME);
if (empty($baseDir)) {
$msg = "The base directory of the document ('${baseDir}') could not be resolved.";
throw new ResolutionExcepti... | [
"public",
"function",
"resolve",
"(",
"$",
"url",
")",
"{",
"$",
"baseUrl",
"=",
"Utils",
"::",
"sanitizeUri",
"(",
"$",
"this",
"->",
"getBasePath",
"(",
")",
")",
";",
"$",
"baseDir",
"=",
"pathinfo",
"(",
"$",
"baseUrl",
",",
"PATHINFO_DIRNAME",
")"... | Resolve a relative $url to a canonical path based
on the LocalFileResolver's base path.
@param string $url A URL to be resolved.
@throws \qtism\common\ResolutionException If $url cannot be resolved. | [
"Resolve",
"a",
"relative",
"$url",
"to",
"a",
"canonical",
"path",
"based",
"on",
"the",
"LocalFileResolver",
"s",
"base",
"path",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/LocalFileResolver.php#L54-L67 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/qtipl/expressions/operators/RoundToQtiPLRenderer.php | RoundToQtiPLRenderer.render | public function render($something)
{
$renderer = new QtiPLRenderer($this->getCRO());
$attributes = [];
if ($something->getRoundingMode() != RoundingMode::SIGNIFICANT_FIGURES) {
$attributes['roundingMode'] = "\"" . RoundingMode::getNameByConstant($something->getRoundingMode()) . ... | php | public function render($something)
{
$renderer = new QtiPLRenderer($this->getCRO());
$attributes = [];
if ($something->getRoundingMode() != RoundingMode::SIGNIFICANT_FIGURES) {
$attributes['roundingMode'] = "\"" . RoundingMode::getNameByConstant($something->getRoundingMode()) . ... | [
"public",
"function",
"render",
"(",
"$",
"something",
")",
"{",
"$",
"renderer",
"=",
"new",
"QtiPLRenderer",
"(",
"$",
"this",
"->",
"getCRO",
"(",
")",
")",
";",
"$",
"attributes",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"something",
"->",
"getRoundin... | Render a QtiComponent object into another constitution.
@param mixed $something Something to render into another consitution.
@return mixed The rendered component into another constitution.
@throws \qtism\runtime\rendering\RenderingException If something goes wrong while rendering the component. | [
"Render",
"a",
"QtiComponent",
"object",
"into",
"another",
"constitution",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/qtipl/expressions/operators/RoundToQtiPLRenderer.php#L47-L60 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/DefaultProcessor.php | DefaultProcessor.process | public function process()
{
$expr = $this->getExpression();
$state = $this->getState();
$var = $state->getVariable($expr->getIdentifier());
return ($var === null) ? null : $var->getDefaultValue();
} | php | public function process()
{
$expr = $this->getExpression();
$state = $this->getState();
$var = $state->getVariable($expr->getIdentifier());
return ($var === null) ? null : $var->getDefaultValue();
} | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"expr",
"=",
"$",
"this",
"->",
"getExpression",
"(",
")",
";",
"$",
"state",
"=",
"$",
"this",
"->",
"getState",
"(",
")",
";",
"$",
"var",
"=",
"$",
"state",
"->",
"getVariable",
"(",
"$",
"e... | Returns the defaultValue of the current Expression to be processed. If no Variable
with the given identifier is found, null is returned. If the Variable has no defaultValue,
null is returned.
@return mixed A QTI Runtime compliant value. | [
"Returns",
"the",
"defaultValue",
"of",
"the",
"current",
"Expression",
"to",
"be",
"processed",
".",
"If",
"no",
"Variable",
"with",
"the",
"given",
"identifier",
"is",
"found",
"null",
"is",
"returned",
".",
"If",
"the",
"Variable",
"has",
"no",
"defaultVa... | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/DefaultProcessor.php#L51-L59 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/SsmlSubMarshaller.php | SsmlSubMarshaller.marshall | protected function marshall(QtiComponent $component)
{
return self::getDOMCradle()->importNode($component->getXml()->documentElement, true);
} | php | protected function marshall(QtiComponent $component)
{
return self::getDOMCradle()->importNode($component->getXml()->documentElement, true);
} | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"return",
"self",
"::",
"getDOMCradle",
"(",
")",
"->",
"importNode",
"(",
"$",
"component",
"->",
"getXml",
"(",
")",
"->",
"documentElement",
",",
"true",
")",
";",
"}"... | Marshall an SSML sub object into a DOMElement object.
@param \qtism\data\QtiComponent $component An SSML sub object.
@return \DOMElement The according DOMElement object.
@throws \MarshallingException | [
"Marshall",
"an",
"SSML",
"sub",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/SsmlSubMarshaller.php#L44-L47 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/SsmlSubMarshaller.php | SsmlSubMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
$node = $element->cloneNode(true);
return new Sub($element->ownerDocument->saveXML($node));
} | php | protected function unmarshall(DOMElement $element)
{
$node = $element->cloneNode(true);
return new Sub($element->ownerDocument->saveXML($node));
} | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"node",
"=",
"$",
"element",
"->",
"cloneNode",
"(",
"true",
")",
";",
"return",
"new",
"Sub",
"(",
"$",
"element",
"->",
"ownerDocument",
"->",
"saveXML",
"(",
"$",... | Unmarshall a DOMElement object corresponding to an SSML sub element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent An SSML sub object.
@throws \UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"an",
"SSML",
"sub",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/SsmlSubMarshaller.php#L56-L61 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/OutcomeMaximumMarshaller.php | OutcomeMaximumMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = parent::marshall($component);
$this->setDOMElementAttribute($element, 'outcomeIdentifier', $component->getOutcomeIdentifier());
$weightIdentifier = $component->getWeightIdentifier();
if (!empty($weightIdentifier)) {
... | php | protected function marshall(QtiComponent $component)
{
$element = parent::marshall($component);
$this->setDOMElementAttribute($element, 'outcomeIdentifier', $component->getOutcomeIdentifier());
$weightIdentifier = $component->getWeightIdentifier();
if (!empty($weightIdentifier)) {
... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"parent",
"::",
"marshall",
"(",
"$",
"component",
")",
";",
"$",
"this",
"->",
"setDOMElementAttribute",
"(",
"$",
"element",
",",
"'outcomeIdentifier'"... | Marshall an outcomeMaximum object in its DOMElement equivalent.
@param \qtism\data\QtiComponent A OutcomeMaximum object.
@return \DOMElement The corresponding outcomeMaximum QTI element. | [
"Marshall",
"an",
"outcomeMaximum",
"object",
"in",
"its",
"DOMElement",
"equivalent",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/OutcomeMaximumMarshaller.php#L43-L54 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/TextInteractionMarshaller.php | TextInteractionMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = $this->createElement($component);
$version = $this->getVersion();
$this->setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
if ($component->getBase() !== 10) {
$t... | php | protected function marshall(QtiComponent $component)
{
$element = $this->createElement($component);
$version = $this->getVersion();
$this->setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
if ($component->getBase() !== 10) {
$t... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"$",
"this",
"->",
"createElement",
"(",
"$",
"component",
")",
";",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"$",
"t... | Marshall a TextEntryInteraction/ExtendedTextInteraction object into a DOMElement object.
@param \qtism\data\QtiComponent $component A TextEntryInteraction/ExtendedTextInteraction object.
@return \DOMElement The according DOMElement object.
@throws \qtism\data\storage\xml\marshalling\MarshallingException | [
"Marshall",
"a",
"TextEntryInteraction",
"/",
"ExtendedTextInteraction",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/TextInteractionMarshaller.php#L47-L103 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/TextInteractionMarshaller.php | TextInteractionMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
$version = $this->getVersion();
if (($responseIdentifier = $this->getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {
try {
$localName = $element->localName;
$name = ($this->i... | php | protected function unmarshall(DOMElement $element)
{
$version = $this->getVersion();
if (($responseIdentifier = $this->getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {
try {
$localName = $element->localName;
$name = ($this->i... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"if",
"(",
"(",
"$",
"responseIdentifier",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$"... | Unmarshall a DOMElement object corresponding to a textEntryInteraction/extendedTextInteraction element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A TextEntryInteraction/ExtendedTextInteraction object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"textEntryInteraction",
"/",
"extendedTextInteraction",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/TextInteractionMarshaller.php#L112-L183 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/GraphicOrderInteraction.php | GraphicOrderInteraction.setHotspotChoices | public function setHotspotChoices(HotspotChoiceCollection $hotspotChoices)
{
if (count($hotspotChoices) > 0) {
$this->hotspotChoices = $hotspotChoices;
} else {
$msg = "A GraphicOrderInteraction must contain at least 1 hotspotChoice object. None given.";
throw new... | php | public function setHotspotChoices(HotspotChoiceCollection $hotspotChoices)
{
if (count($hotspotChoices) > 0) {
$this->hotspotChoices = $hotspotChoices;
} else {
$msg = "A GraphicOrderInteraction must contain at least 1 hotspotChoice object. None given.";
throw new... | [
"public",
"function",
"setHotspotChoices",
"(",
"HotspotChoiceCollection",
"$",
"hotspotChoices",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"hotspotChoices",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"hotspotChoices",
"=",
"$",
"hotspotChoices",
";",
"}",
"e... | Set the hotspots that define the choices that are to be ordered by the candidate.
@param \qtism\data\content\interactions\HotspotChoiceCollection $hotspotChoices A collection of HotspotChoice objects.
@throws \InvalidArgumentException If the given $hotspotChoices collection is empty. | [
"Set",
"the",
"hotspots",
"that",
"define",
"the",
"choices",
"that",
"are",
"to",
"be",
"ordered",
"by",
"the",
"candidate",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/GraphicOrderInteraction.php#L119-L127 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/GraphicOrderInteraction.php | GraphicOrderInteraction.setMinChoices | public function setMinChoices($minChoices)
{
if (is_int($minChoices) && $minChoices !== 0) {
if ($minChoices > count($this->getHotspotChoices())) {
$msg = "The 'minChoices' argument must not exceed the number of choices available.";
throw new InvalidArgumentExcep... | php | public function setMinChoices($minChoices)
{
if (is_int($minChoices) && $minChoices !== 0) {
if ($minChoices > count($this->getHotspotChoices())) {
$msg = "The 'minChoices' argument must not exceed the number of choices available.";
throw new InvalidArgumentExcep... | [
"public",
"function",
"setMinChoices",
"(",
"$",
"minChoices",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"minChoices",
")",
"&&",
"$",
"minChoices",
"!==",
"0",
")",
"{",
"if",
"(",
"$",
"minChoices",
">",
"count",
"(",
"$",
"this",
"->",
"getHotspotCho... | Set the minimum number of choices that the candidate must select and order to form a valid response. A negative
value indicates that no minChoice is indicated.
@param integer $minChoices A strictly negative or positive integer.
@throws \InvalidArgumentException If $minChoice is not a strictly negative or positive inte... | [
"Set",
"the",
"minimum",
"number",
"of",
"choices",
"that",
"the",
"candidate",
"must",
"select",
"and",
"order",
"to",
"form",
"a",
"valid",
"response",
".",
"A",
"negative",
"value",
"indicates",
"that",
"no",
"minChoice",
"is",
"indicated",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/GraphicOrderInteraction.php#L146-L160 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/GraphicOrderInteraction.php | GraphicOrderInteraction.setMaxChoices | public function setMaxChoices($maxChoices)
{
if (is_int($maxChoices) && $maxChoices !== 0) {
if ($this->getMinChoices() > 0 && $maxChoices < $this->getMinChoices()) {
$msg = "The 'maxChoices' argument must be greater than or equal to the 'minChoices' attribute.";
... | php | public function setMaxChoices($maxChoices)
{
if (is_int($maxChoices) && $maxChoices !== 0) {
if ($this->getMinChoices() > 0 && $maxChoices < $this->getMinChoices()) {
$msg = "The 'maxChoices' argument must be greater than or equal to the 'minChoices' attribute.";
... | [
"public",
"function",
"setMaxChoices",
"(",
"$",
"maxChoices",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"maxChoices",
")",
"&&",
"$",
"maxChoices",
"!==",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getMinChoices",
"(",
")",
">",
"0",
"&&",
"$",
... | Set the maximum number of choices that the candidate must select and order to form a valid response. A negative
value indicates that no maxChoice is indicated.
@param integer $maxChoices A strictly negative or positive integer.
@throws \InvalidArgumentException If $maxChoices is not a strictly negative or positive int... | [
"Set",
"the",
"maximum",
"number",
"of",
"choices",
"that",
"the",
"candidate",
"must",
"select",
"and",
"order",
"to",
"form",
"a",
"valid",
"response",
".",
"A",
"negative",
"value",
"indicates",
"that",
"no",
"maxChoice",
"is",
"indicated",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/GraphicOrderInteraction.php#L190-L204 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/TemplateDefaultMarshaller.php | TemplateDefaultMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'templateIdentifier', $component->getTemplateIdentifier());
$expr = $component->getExpression();
$exprMars... | php | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'templateIdentifier', $component->getTemplateIdentifier());
$expr = $component->getExpression();
$exprMars... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"static",
"::",
"getDOMCradle",
"(",
")",
"->",
"createElement",
"(",
"$",
"component",
"->",
"getQtiClassName",
"(",
")",
")",
";",
"$",
"this",
"->... | Marshall a TemplateDefault object into a DOMElement object.
@param \qtism\data\QtiComponent $component A TemplateDefault object.
@return \DOMElement The according DOMElement object. | [
"Marshall",
"a",
"TemplateDefault",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/TemplateDefaultMarshaller.php#L43-L56 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/TemplateDefaultMarshaller.php | TemplateDefaultMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
if (($tplIdentifier = $this->getDOMElementAttributeAs($element, 'templateIdentifier')) !== null) {
$expressionElt = self::getFirstChildElement($element);
if ($expressionElt !== false) {
$exprMarshaller = $this->ge... | php | protected function unmarshall(DOMElement $element)
{
if (($tplIdentifier = $this->getDOMElementAttributeAs($element, 'templateIdentifier')) !== null) {
$expressionElt = self::getFirstChildElement($element);
if ($expressionElt !== false) {
$exprMarshaller = $this->ge... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"if",
"(",
"(",
"$",
"tplIdentifier",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'templateIdentifier'",
")",
")",
"!==",
"null",
")",
"{",... | Unmarshall a DOMElement object corresponding to a QTI templateDefault element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A templateDefault object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException If the mandatory attribute 'templateIdentifier' is missing or has... | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"templateDefault",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/TemplateDefaultMarshaller.php#L65-L86 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/AssociableHotspot.php | AssociableHotspot.setMatchMax | public function setMatchMax($matchMax)
{
if (is_int($matchMax) === true && $matchMax >= 0) {
$this->matchMax = $matchMax;
} else {
$msg = "The 'matchMax' argument must be a positive integer, '" . gettype($matchMax) . "' given.";
throw new InvalidArgumentException(... | php | public function setMatchMax($matchMax)
{
if (is_int($matchMax) === true && $matchMax >= 0) {
$this->matchMax = $matchMax;
} else {
$msg = "The 'matchMax' argument must be a positive integer, '" . gettype($matchMax) . "' given.";
throw new InvalidArgumentException(... | [
"public",
"function",
"setMatchMax",
"(",
"$",
"matchMax",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"matchMax",
")",
"===",
"true",
"&&",
"$",
"matchMax",
">=",
"0",
")",
"{",
"$",
"this",
"->",
"matchMax",
"=",
"$",
"matchMax",
";",
"}",
"else",
"... | Set the matchMax of the associableHotspot.
@param integer $matchMax A positive (>= 0) integer.
@throws \InvalidArgumentException If $matchMax is not a positive integer. | [
"Set",
"the",
"matchMax",
"of",
"the",
"associableHotspot",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/AssociableHotspot.php#L137-L145 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/AssociableHotspot.php | AssociableHotspot.setMatchMin | public function setMatchMin($matchMin)
{
if (is_int($matchMin) === true && $matchMin >= 0) {
$this->matchMin = $matchMin;
} else {
$msg = "The 'matchMin' argument must be a positive integer, '" . gettype($matchMin) . "' given.";
throw new InvalidArgumentException(... | php | public function setMatchMin($matchMin)
{
if (is_int($matchMin) === true && $matchMin >= 0) {
$this->matchMin = $matchMin;
} else {
$msg = "The 'matchMin' argument must be a positive integer, '" . gettype($matchMin) . "' given.";
throw new InvalidArgumentException(... | [
"public",
"function",
"setMatchMin",
"(",
"$",
"matchMin",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"matchMin",
")",
"===",
"true",
"&&",
"$",
"matchMin",
">=",
"0",
")",
"{",
"$",
"this",
"->",
"matchMin",
"=",
"$",
"matchMin",
";",
"}",
"else",
"... | Set the matchMin of the associableHotspot.
@param integer $matchMin A positive (>= 0) integer.
@throws \InvalidArgumentException If $matchMin is not a positive integer. | [
"Set",
"the",
"matchMin",
"of",
"the",
"associableHotspot",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/AssociableHotspot.php#L163-L171 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/AssociableHotspot.php | AssociableHotspot.setHotspotLabel | public function setHotspotLabel($hotspotLabel)
{
if (Format::isString256($hotspotLabel) === true) {
$this->hotspotLabel = $hotspotLabel;
} else {
$msg = "The 'hotspotLabel' argument must be a string value with at most 256 characters.";
throw new InvalidArgumentExc... | php | public function setHotspotLabel($hotspotLabel)
{
if (Format::isString256($hotspotLabel) === true) {
$this->hotspotLabel = $hotspotLabel;
} else {
$msg = "The 'hotspotLabel' argument must be a string value with at most 256 characters.";
throw new InvalidArgumentExc... | [
"public",
"function",
"setHotspotLabel",
"(",
"$",
"hotspotLabel",
")",
"{",
"if",
"(",
"Format",
"::",
"isString256",
"(",
"$",
"hotspotLabel",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"hotspotLabel",
"=",
"$",
"hotspotLabel",
";",
"}",
"else",
... | Set the hotspotLabel of the associableHotspot.
@param string $hotspotLabel A string with at most 256 characters.
@throws \InvalidArgumentException If $hotspotLabel has more than 256 characters. | [
"Set",
"the",
"hotspotLabel",
"of",
"the",
"associableHotspot",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/AssociableHotspot.php#L234-L242 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/CustomInteractionMarshaller.php | CustomInteractionMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = $this->createElement($component);
$this->fillElement($element, $component);
$this->setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
if ($component->hasXmlBase() === true) {
... | php | protected function marshall(QtiComponent $component)
{
$element = $this->createElement($component);
$this->fillElement($element, $component);
$this->setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
if ($component->hasXmlBase() === true) {
... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"$",
"this",
"->",
"createElement",
"(",
"$",
"component",
")",
";",
"$",
"this",
"->",
"fillElement",
"(",
"$",
"element",
",",
"$",
"component",
... | Marshall a CustomInteraction object into a DOMElement object.
@param \qtism\data\QtiComponent $component A CustomInteraction object.
@return \DOMElement The according DOMElement object. | [
"Marshall",
"a",
"CustomInteraction",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/CustomInteractionMarshaller.php#L44-L59 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/CustomInteractionMarshaller.php | CustomInteractionMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
if (($responseIdentifier = $this->getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {
$frag = $element->ownerDocument->createDocumentFragment();
$element = $element->cloneNode(true);
$frag->appendChil... | php | protected function unmarshall(DOMElement $element)
{
if (($responseIdentifier = $this->getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {
$frag = $element->ownerDocument->createDocumentFragment();
$element = $element->cloneNode(true);
$frag->appendChil... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"if",
"(",
"(",
"$",
"responseIdentifier",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'responseIdentifier'",
")",
")",
"!==",
"null",
")",
... | Unmarshall a DOMElement object corresponding to a QTI customInteraction element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A CustomInteraction object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"customInteraction",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/CustomInteractionMarshaller.php#L68-L82 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/text/Blockquote.php | Blockquote.setCite | public function setCite($cite)
{
if (Format::isUri($cite) === true) {
$this->cite = $cite;
} else {
$msg = "The 'cite' argument must be a valid URI, '" . $cite . "' given.";
throw new InvalidArgumentException($msg);
}
} | php | public function setCite($cite)
{
if (Format::isUri($cite) === true) {
$this->cite = $cite;
} else {
$msg = "The 'cite' argument must be a valid URI, '" . $cite . "' given.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setCite",
"(",
"$",
"cite",
")",
"{",
"if",
"(",
"Format",
"::",
"isUri",
"(",
"$",
"cite",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"cite",
"=",
"$",
"cite",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The 'cite' ar... | Set the cite attribute's value.
@param string $cite
@throws InvalidArgumentException If $cite is not a valid URI. | [
"Set",
"the",
"cite",
"attribute",
"s",
"value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/text/Blockquote.php#L77-L85 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/HotspotMarshaller.php | HotspotMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$version = $this->getVersion();
$element = $this->createElement($component);
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
$this->setDOMElementAttribute($element, 'shape', QtiShape::getNameBy... | php | protected function marshall(QtiComponent $component)
{
$version = $this->getVersion();
$element = $this->createElement($component);
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
$this->setDOMElementAttribute($element, 'shape', QtiShape::getNameBy... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"$",
"element",
"=",
"$",
"this",
"->",
"createElement",
"(",
"$",
"component",
")",
";",
"$",
"t... | Marshall a HotspotChoice/AssociableHotspot object into a DOMElement object.
@param \qtism\data\QtiComponent $component A HotspotChoice/AssociableHotspot object.
@return \DOMElement The according DOMElement object.
@throws \qtism\data\storage\xml\marshalling\MarshallingException | [
"Marshall",
"a",
"HotspotChoice",
"/",
"AssociableHotspot",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/HotspotMarshaller.php#L52-L99 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/HotspotMarshaller.php | HotspotMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
$version = $this->getVersion();
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
if (($shape = $this->getDOMElementAttributeAs($element, 'shape')) !== null) {
if (($coords = $thi... | php | protected function unmarshall(DOMElement $element)
{
$version = $this->getVersion();
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
if (($shape = $this->getDOMElementAttributeAs($element, 'shape')) !== null) {
if (($coords = $thi... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"if",
"(",
"(",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"ele... | Unmarshall a DOMElement object corresponding to a hotspotChoice/associableHotspot element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A HotspotChoice/AssociableHotspot object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"hotspotChoice",
"/",
"associableHotspot",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/HotspotMarshaller.php#L108-L195 |
oat-sa/qti-sdk | src/qtism/common/datatypes/Utils.php | Utils.isQtiInteger | public static function isQtiInteger($integer)
{
// QTI integers are twos-complement 32-bits integers.
if (is_int($integer) === false) {
return false;
} elseif ($integer > 2147483647) {
return false;
} elseif ($integer < -2147483647) {
return false;... | php | public static function isQtiInteger($integer)
{
// QTI integers are twos-complement 32-bits integers.
if (is_int($integer) === false) {
return false;
} elseif ($integer > 2147483647) {
return false;
} elseif ($integer < -2147483647) {
return false;... | [
"public",
"static",
"function",
"isQtiInteger",
"(",
"$",
"integer",
")",
"{",
"// QTI integers are twos-complement 32-bits integers.",
"if",
"(",
"is_int",
"(",
"$",
"integer",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"elseif",
"(",
"$",
"i... | Whether a given $integer value is a QTI compliant
integer in the [-2147483647, 2147483647] range.
@param mixed $integer
@return boolean | [
"Whether",
"a",
"given",
"$integer",
"value",
"is",
"a",
"QTI",
"compliant",
"integer",
"in",
"the",
"[",
"-",
"2147483647",
"2147483647",
"]",
"range",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/Utils.php#L41-L53 |
oat-sa/qti-sdk | src/qtism/common/collections/Container.php | Container.equals | public function equals($obj)
{
if (gettype($obj) === 'object' && $obj instanceof static && count($obj) === count($this)) {
foreach (array_keys($this->getDataPlaceHolder()) as $key) {
$t = $this[$key];
$occurencesA = $this->occurences($t);
$occurenc... | php | public function equals($obj)
{
if (gettype($obj) === 'object' && $obj instanceof static && count($obj) === count($this)) {
foreach (array_keys($this->getDataPlaceHolder()) as $key) {
$t = $this[$key];
$occurencesA = $this->occurences($t);
$occurenc... | [
"public",
"function",
"equals",
"(",
"$",
"obj",
")",
"{",
"if",
"(",
"gettype",
"(",
"$",
"obj",
")",
"===",
"'object'",
"&&",
"$",
"obj",
"instanceof",
"static",
"&&",
"count",
"(",
"$",
"obj",
")",
"===",
"count",
"(",
"$",
"this",
")",
")",
"... | Wheter the container is equal to $obj.
* If $obj is not an instance of Container, false is returned.
* If $obj is [A,B,C] and the container is [C,A,B], true is returned because the order does not matter.
* If $obj is [A,B,C] and the container is [B,C,D], false is returned.
* If $obj is [] and the container is [], true... | [
"Wheter",
"the",
"container",
"is",
"equal",
"to",
"$obj",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/collections/Container.php#L133-L151 |
oat-sa/qti-sdk | src/qtism/common/collections/Container.php | Container.occurences | public function occurences($obj)
{
$occurences = 0;
foreach (array_keys($this->getDataPlaceHolder()) as $key) {
$t = $this[$key];
if (gettype($obj) === 'object' && $obj instanceof Comparable) {
// try to use Comparable.
if ($obj->equals($t)) {... | php | public function occurences($obj)
{
$occurences = 0;
foreach (array_keys($this->getDataPlaceHolder()) as $key) {
$t = $this[$key];
if (gettype($obj) === 'object' && $obj instanceof Comparable) {
// try to use Comparable.
if ($obj->equals($t)) {... | [
"public",
"function",
"occurences",
"(",
"$",
"obj",
")",
"{",
"$",
"occurences",
"=",
"0",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
")",
"as",
"$",
"key",
")",
"{",
"$",
"t",
"=",
"$",
"this",
"[",... | Get the number of occurences of a given $obj in the container.
* If $obj is an instance of Comparable, an equality check will be performed using the Comparable::equals method of $obj.
* If $obj is a primitive type, a strict comparison (===) will be applied.
@param mixed $obj The object you want to find the number of ... | [
"Get",
"the",
"number",
"of",
"occurences",
"of",
"a",
"given",
"$obj",
"in",
"the",
"container",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/collections/Container.php#L162-L187 |
oat-sa/qti-sdk | src/qtism/common/collections/Container.php | Container.createFromDataModel | public static function createFromDataModel(ValueCollection $valueCollection)
{
$container = new static();
foreach ($valueCollection as $value) {
$container[] = RuntimeUtils::valueToRuntime($value->getValue(), $value->getBaseType());
}
return $container;
} | php | public static function createFromDataModel(ValueCollection $valueCollection)
{
$container = new static();
foreach ($valueCollection as $value) {
$container[] = RuntimeUtils::valueToRuntime($value->getValue(), $value->getBaseType());
}
return $container;
} | [
"public",
"static",
"function",
"createFromDataModel",
"(",
"ValueCollection",
"$",
"valueCollection",
")",
"{",
"$",
"container",
"=",
"new",
"static",
"(",
")",
";",
"foreach",
"(",
"$",
"valueCollection",
"as",
"$",
"value",
")",
"{",
"$",
"container",
"[... | Create a Container object from a Data Model ValueCollection object.
@param \qtism\data\state\ValueCollection $valueCollection A collection of qtism\data\state\Value objects.
@return \qtism\common\collections\Container A Container object populated with the values found in $valueCollection.
@throws \InvalidArgumentExcep... | [
"Create",
"a",
"Container",
"object",
"from",
"a",
"Data",
"Model",
"ValueCollection",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/collections/Container.php#L196-L204 |
oat-sa/qti-sdk | src/qtism/common/collections/Container.php | Container.distinct | public function distinct()
{
$container = clone $this;
$newDataPlaceHolder = [];
foreach ($this->getDataPlaceHolder() as $key => $value) {
$found = false;
foreach ($newDataPlaceHolder as $newValue) {
... | php | public function distinct()
{
$container = clone $this;
$newDataPlaceHolder = [];
foreach ($this->getDataPlaceHolder() as $key => $value) {
$found = false;
foreach ($newDataPlaceHolder as $newValue) {
... | [
"public",
"function",
"distinct",
"(",
")",
"{",
"$",
"container",
"=",
"clone",
"$",
"this",
";",
"$",
"newDataPlaceHolder",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getDataPlaceHolder",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
... | Get Distinct Container Copy.
Provides a copy of the container, with distinct values. In other words,
any duplicated values from the container will not appear in the returned
container.
Please note that the container copy is a shallow copy of the original, not
a deep copy.
@return \qtism\common\collections\Container | [
"Get",
"Distinct",
"Container",
"Copy",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/collections/Container.php#L278-L313 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/RepeatProcessor.php | RepeatProcessor.process | public function process()
{
$operands = $this->getOperands();
// get the value of numberRepeats
$expression = $this->getExpression();
$numberRepeats = $expression->getNumberRepeats();
if (gettype($numberRepeats) === 'string') {
// Variable reference found.
... | php | public function process()
{
$operands = $this->getOperands();
// get the value of numberRepeats
$expression = $this->getExpression();
$numberRepeats = $expression->getNumberRepeats();
if (gettype($numberRepeats) === 'string') {
// Variable reference found.
... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"// get the value of numberRepeats",
"$",
"expression",
"=",
"$",
"this",
"->",
"getExpression",
"(",
")",
";",
"$",
"numberRepeats",
"=",
... | Process the Repeat operator.
Note: NULL values are simply ignored. If all sub-expressions are NULL, NULL is
returned.
@return \qtism\runtime\common\OrderedContainer An ordered container filled sequentially by evaluating each sub-expressions, repeated a 'numberRepeats' of times. NULL is returned if all sub-expressions... | [
"Process",
"the",
"Repeat",
"operator",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/RepeatProcessor.php#L67-L141 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderer.php | AbstractMarkupRenderer.transformUri | protected function transformUri($url, $baseUrl)
{
// Only relative URIs must be transformed while
// taking xml:base into account.
if (Url::isRelative($url) === false) {
return $url;
}
$xmlBasePolicy = $this->getRenderingEngine()->getXmlBasePolicy();
swi... | php | protected function transformUri($url, $baseUrl)
{
// Only relative URIs must be transformed while
// taking xml:base into account.
if (Url::isRelative($url) === false) {
return $url;
}
$xmlBasePolicy = $this->getRenderingEngine()->getXmlBasePolicy();
swi... | [
"protected",
"function",
"transformUri",
"(",
"$",
"url",
",",
"$",
"baseUrl",
")",
"{",
"// Only relative URIs must be transformed while",
"// taking xml:base into account.",
"if",
"(",
"Url",
"::",
"isRelative",
"(",
"$",
"url",
")",
"===",
"false",
")",
"{",
"r... | Transform a URL depending on a given $baseUrl and how the
rendering engine is considering them.
@param string $url A given URL (Uniform Resource Locator).
@param string $baseUrl a baseUrl (xml:base).
@return string A transformed URL. | [
"Transform",
"a",
"URL",
"depending",
"on",
"a",
"given",
"$baseUrl",
"and",
"how",
"the",
"rendering",
"engine",
"is",
"considering",
"them",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderer.php#L75-L99 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/NumberIncorrectProcessor.php | NumberIncorrectProcessor.process | public function process()
{
$testSession = $this->getState();
$itemSubset = $this->getItemSubset();
$numberIncorrect = 0;
foreach ($itemSubset as $item) {
$itemSessions = $testSession->getAssessmentItemSessions($item->getIdentifier());
if ($itemS... | php | public function process()
{
$testSession = $this->getState();
$itemSubset = $this->getItemSubset();
$numberIncorrect = 0;
foreach ($itemSubset as $item) {
$itemSessions = $testSession->getAssessmentItemSessions($item->getIdentifier());
if ($itemS... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"testSession",
"=",
"$",
"this",
"->",
"getState",
"(",
")",
";",
"$",
"itemSubset",
"=",
"$",
"this",
"->",
"getItemSubset",
"(",
")",
";",
"$",
"numberIncorrect",
"=",
"0",
";",
"foreach",
"(",
"... | Process the related NumberIncorrect expression.
@return integer The number of items in the given sub-set for which at least one of the defined response does not match its associated correct response.
@throws \qtism\runtime\expressions\ExpressionProcessingException | [
"Process",
"the",
"related",
"NumberIncorrect",
"expression",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/NumberIncorrectProcessor.php#L53-L72 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/AssociateInteraction.php | AssociateInteraction.setMaxAssociations | public function setMaxAssociations($maxAssociations)
{
if (is_int($maxAssociations) === true && $maxAssociations >= 0) {
$this->maxAssociations = $maxAssociations;
} else {
$msg = "The 'maxAssociations' argument must be a positive (>= 0) integer, '" . gettype($maxAssociations... | php | public function setMaxAssociations($maxAssociations)
{
if (is_int($maxAssociations) === true && $maxAssociations >= 0) {
$this->maxAssociations = $maxAssociations;
} else {
$msg = "The 'maxAssociations' argument must be a positive (>= 0) integer, '" . gettype($maxAssociations... | [
"public",
"function",
"setMaxAssociations",
"(",
"$",
"maxAssociations",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"maxAssociations",
")",
"===",
"true",
"&&",
"$",
"maxAssociations",
">=",
"0",
")",
"{",
"$",
"this",
"->",
"maxAssociations",
"=",
"$",
"max... | Set the maximum number of associations the candidate is required to make. If $maxAssociations
is 0, there is no maximum number of associations.
@param integer $maxAssociations A positive (>= 0) integer.
@throws \InvalidArgumentException If $maxAssociations is not a positive integer. | [
"Set",
"the",
"maximum",
"number",
"of",
"associations",
"the",
"candidate",
"is",
"required",
"to",
"make",
".",
"If",
"$maxAssociations",
"is",
"0",
"there",
"is",
"no",
"maximum",
"number",
"of",
"associations",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/AssociateInteraction.php#L146-L154 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/AssociateInteraction.php | AssociateInteraction.setMinAssociations | public function setMinAssociations($minAssociations)
{
if (is_int($minAssociations) === true && $minAssociations >= 0) {
if ($this->hasMaxAssociations() === true && $minAssociations > $this->getMaxAssociations()) {
$msg = "The 'minAssociation' argument must be less than or equal... | php | public function setMinAssociations($minAssociations)
{
if (is_int($minAssociations) === true && $minAssociations >= 0) {
if ($this->hasMaxAssociations() === true && $minAssociations > $this->getMaxAssociations()) {
$msg = "The 'minAssociation' argument must be less than or equal... | [
"public",
"function",
"setMinAssociations",
"(",
"$",
"minAssociations",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"minAssociations",
")",
"===",
"true",
"&&",
"$",
"minAssociations",
">=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasMaxAssociations",
... | Set the minimum number of associations that the candidate is required to make. If
$minAssociations is 0, there is no minimum number of associations required.
@param integer $minAssociations A positive (>= 0) integer.
@throws \InvalidArgumentException If $minAssociations is not a positive integer or if $minAssociations... | [
"Set",
"the",
"minimum",
"number",
"of",
"associations",
"that",
"the",
"candidate",
"is",
"required",
"to",
"make",
".",
"If",
"$minAssociations",
"is",
"0",
"there",
"is",
"no",
"minimum",
"number",
"of",
"associations",
"required",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/AssociateInteraction.php#L184-L198 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/AssociateInteraction.php | AssociateInteraction.setSimpleAssociableChoices | public function setSimpleAssociableChoices(SimpleAssociableChoiceCollection $simpleAssociableChoices)
{
if (count($simpleAssociableChoices) > 0) {
$this->simpleAssociableChoices = $simpleAssociableChoices;
} else {
$msg = "An AssociateInteraction object must be composed of at... | php | public function setSimpleAssociableChoices(SimpleAssociableChoiceCollection $simpleAssociableChoices)
{
if (count($simpleAssociableChoices) > 0) {
$this->simpleAssociableChoices = $simpleAssociableChoices;
} else {
$msg = "An AssociateInteraction object must be composed of at... | [
"public",
"function",
"setSimpleAssociableChoices",
"(",
"SimpleAssociableChoiceCollection",
"$",
"simpleAssociableChoices",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"simpleAssociableChoices",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"simpleAssociableChoices",
"=",
... | Set the choices.
@param \qtism\data\content\interactions\SimpleAssociableChoiceCollection $simpleAssociableChoices A collection of at least one SimpleAssociableChoice object.
@throws \InvalidArgumentException If $simpleAssociableChoices is empty. | [
"Set",
"the",
"choices",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/AssociateInteraction.php#L227-L235 |
oat-sa/qti-sdk | src/qtism/data/content/RubricBlock.php | RubricBlock.setViews | public function setViews(ViewCollection $views)
{
if (count($views) > 0) {
$this->views = $views;
} else {
$msg = "A RubricBlock object must contain at least one View.";
throw new InvalidArgumentException($msg);
}
} | php | public function setViews(ViewCollection $views)
{
if (count($views) > 0) {
$this->views = $views;
} else {
$msg = "A RubricBlock object must contain at least one View.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setViews",
"(",
"ViewCollection",
"$",
"views",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"views",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"views",
"=",
"$",
"views",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"A RubricBlock... | Set the views in which the rubric block's content are to be shown.
@param \qtism\data\ViewCollection $views A collection of values that belong to the View enumeration.
@throws \InvalidArgumentException If $views is an empty collection. | [
"Set",
"the",
"views",
"in",
"which",
"the",
"rubric",
"block",
"s",
"content",
"are",
"to",
"be",
"shown",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/RubricBlock.php#L111-L119 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/Utils.php | Utils.sanitizeVariableRef | public static function sanitizeVariableRef($variableRef)
{
if (gettype($variableRef) === 'string') {
return trim($variableRef, '{}');
} else {
$msg = "The Utils::sanitizeVariableRef method only accepts a string argument, '" . gettype($variableRef) . "' given.";
th... | php | public static function sanitizeVariableRef($variableRef)
{
if (gettype($variableRef) === 'string') {
return trim($variableRef, '{}');
} else {
$msg = "The Utils::sanitizeVariableRef method only accepts a string argument, '" . gettype($variableRef) . "' given.";
th... | [
"public",
"static",
"function",
"sanitizeVariableRef",
"(",
"$",
"variableRef",
")",
"{",
"if",
"(",
"gettype",
"(",
"$",
"variableRef",
")",
"===",
"'string'",
")",
"{",
"return",
"trim",
"(",
"$",
"variableRef",
",",
"'{}'",
")",
";",
"}",
"else",
"{",... | Removes trailing and ending braces ('{' and '}') from a variableRef.
@return string A sanitized variableRef. | [
"Removes",
"trailing",
"and",
"ending",
"braces",
"(",
"{",
"and",
"}",
")",
"from",
"a",
"variableRef",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/Utils.php#L42-L50 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/ExpressionEngine.php | ExpressionEngine.setComponent | public function setComponent(QtiComponent $expression)
{
if ($expression instanceof Expression) {
parent::setComponent($expression);
} else {
$msg = "The ExpressionEngine class only accepts QTI Data Model Expression objects to be processed.";
throw new InvalidArgu... | php | public function setComponent(QtiComponent $expression)
{
if ($expression instanceof Expression) {
parent::setComponent($expression);
} else {
$msg = "The ExpressionEngine class only accepts QTI Data Model Expression objects to be processed.";
throw new InvalidArgu... | [
"public",
"function",
"setComponent",
"(",
"QtiComponent",
"$",
"expression",
")",
"{",
"if",
"(",
"$",
"expression",
"instanceof",
"Expression",
")",
"{",
"parent",
"::",
"setComponent",
"(",
"$",
"expression",
")",
";",
"}",
"else",
"{",
"$",
"msg",
"=",... | Set the Expression object to be processed.
@param \qtism\data\QtiComponent $expression An Expression object.
@throws \InvalidArgumentException If $expression is not an Expression object. | [
"Set",
"the",
"Expression",
"object",
"to",
"be",
"processed",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/ExpressionEngine.php#L105-L113 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/ExpressionEngine.php | ExpressionEngine.pushTrail | protected function pushTrail($expression)
{
if ($expression instanceof Expression) {
array_push($this->trail, $expression);
} else {
// Add the collection in reverse order.
$i = count($expression);
while ($i >= 1) {
$i--;
... | php | protected function pushTrail($expression)
{
if ($expression instanceof Expression) {
array_push($this->trail, $expression);
} else {
// Add the collection in reverse order.
$i = count($expression);
while ($i >= 1) {
$i--;
... | [
"protected",
"function",
"pushTrail",
"(",
"$",
"expression",
")",
"{",
"if",
"(",
"$",
"expression",
"instanceof",
"Expression",
")",
"{",
"array_push",
"(",
"$",
"this",
"->",
"trail",
",",
"$",
"expression",
")",
";",
"}",
"else",
"{",
"// Add the colle... | Push an Expression object on the trail stack.
@param \qtism\data\expressions\Expression|\qtism\data\expressions\ExpressionCollection $expression An Expression/ExpressionCollection object to be pushed on top of the trail stack. | [
"Push",
"an",
"Expression",
"object",
"on",
"the",
"trail",
"stack",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/ExpressionEngine.php#L150-L162 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/ExpressionEngine.php | ExpressionEngine.process | public function process()
{
$expression = $this->getComponent();
// Reset trail and marker arrays.
$this->trail = array();
$this->marker = array();
$this->pushTrail($expression);
while (count($this->getTrail()) > 0) {
$expression = $this->popTrail();
... | php | public function process()
{
$expression = $this->getComponent();
// Reset trail and marker arrays.
$this->trail = array();
$this->marker = array();
$this->pushTrail($expression);
while (count($this->getTrail()) > 0) {
$expression = $this->popTrail();
... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"expression",
"=",
"$",
"this",
"->",
"getComponent",
"(",
")",
";",
"// Reset trail and marker arrays.",
"$",
"this",
"->",
"trail",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"marker",
"=",
"arr... | Process the current Expression object according to the current
execution context.
@throws \qtism\runtime\expressions\ExpressionProcessingException|\qtism\runtime\expressions\operators\OperatorProcessingException If an error occurs during the Expression processing. | [
"Process",
"the",
"current",
"Expression",
"object",
"according",
"to",
"the",
"current",
"execution",
"context",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/ExpressionEngine.php#L210-L261 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/ExpressionEngine.php | ExpressionEngine.traceExpression | protected function traceExpression(ExpressionProcessor $processor, $result)
{
$qtiClassName = $processor->getExpression()->getQtiClassName();
$this->trace("${qtiClassName} [${result}]");
} | php | protected function traceExpression(ExpressionProcessor $processor, $result)
{
$qtiClassName = $processor->getExpression()->getQtiClassName();
$this->trace("${qtiClassName} [${result}]");
} | [
"protected",
"function",
"traceExpression",
"(",
"ExpressionProcessor",
"$",
"processor",
",",
"$",
"result",
")",
"{",
"$",
"qtiClassName",
"=",
"$",
"processor",
"->",
"getExpression",
"(",
")",
"->",
"getQtiClassName",
"(",
")",
";",
"$",
"this",
"->",
"t... | Trace a given Expression $processor execution.
@param \qtism\runtime\expressions\ExpressionProcessor $processor The processor that undertook the processing.
@param mixed $result The result of the processing. | [
"Trace",
"a",
"given",
"Expression",
"$processor",
"execution",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/ExpressionEngine.php#L269-L273 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/ExpressionEngine.php | ExpressionEngine.traceOperator | protected function traceOperator(OperatorProcessor $processor, $result)
{
$stringOperands = array();
foreach ($processor->getOperands() as $operand) {
$stringOperands[] = '' . $operand;
}
$qtiClassName = $processor->getExpression()->getQtiClassName();
$msg = "${... | php | protected function traceOperator(OperatorProcessor $processor, $result)
{
$stringOperands = array();
foreach ($processor->getOperands() as $operand) {
$stringOperands[] = '' . $operand;
}
$qtiClassName = $processor->getExpression()->getQtiClassName();
$msg = "${... | [
"protected",
"function",
"traceOperator",
"(",
"OperatorProcessor",
"$",
"processor",
",",
"$",
"result",
")",
"{",
"$",
"stringOperands",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"processor",
"->",
"getOperands",
"(",
")",
"as",
"$",
"operand",
"... | Trace a given Operator $processor execution.
@param \qtism\runtime\expressions\operators\OperatorProcessor $processor The processor that undertook the processing.
@param mixed $result The result of the processing. | [
"Trace",
"a",
"given",
"Operator",
"$processor",
"execution",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/ExpressionEngine.php#L281-L292 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/LteProcessor.php | LteProcessor.process | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The Lte operator only accepts operands with a single cardinality.";
thr... | php | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The Lte operator only accepts operands with a single cardinality.";
thr... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"if",
"(",
"$",
"operands",
"->",
"containsNull",
"(",
")",
"===",
"true",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
... | Process the Lte operator.
@return boolean|null Whether the first sub-expression is numerically less than or equal to the second or NULL if either sub-expression is NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException | [
"Process",
"the",
"Lte",
"operator",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/LteProcessor.php#L53-L72 |
oat-sa/qti-sdk | src/qtism/common/datatypes/files/FileSystemFile.php | FileSystemFile.getData | public function getData()
{
$fp = $this->getStream();
$data = '';
while (feof($fp) === false) {
$data .= fread($fp, self::CHUNK_SIZE);
}
@fclose($fp);
return $data;
} | php | public function getData()
{
$fp = $this->getStream();
$data = '';
while (feof($fp) === false) {
$data .= fread($fp, self::CHUNK_SIZE);
}
@fclose($fp);
return $data;
} | [
"public",
"function",
"getData",
"(",
")",
"{",
"$",
"fp",
"=",
"$",
"this",
"->",
"getStream",
"(",
")",
";",
"$",
"data",
"=",
"''",
";",
"while",
"(",
"feof",
"(",
"$",
"fp",
")",
"===",
"false",
")",
"{",
"$",
"data",
".=",
"fread",
"(",
... | Get the sequence of bytes composing the content of the file.
@throws \RuntimeException If the data cannot be retrieved. | [
"Get",
"the",
"sequence",
"of",
"bytes",
"composing",
"the",
"content",
"of",
"the",
"file",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/files/FileSystemFile.php#L164-L176 |
oat-sa/qti-sdk | src/qtism/common/datatypes/files/FileSystemFile.php | FileSystemFile.getStream | public function getStream()
{
$fp = @fopen($this->getPath(), 'rb');
if ($fp === false) {
$msg = "Cannot retrieve QTI File Stream from '" . $this->getPath() . "'.";
throw new RuntimeException($msg);
}
$len = current(unpack('S', fread($fp, 2)));
fseek(... | php | public function getStream()
{
$fp = @fopen($this->getPath(), 'rb');
if ($fp === false) {
$msg = "Cannot retrieve QTI File Stream from '" . $this->getPath() . "'.";
throw new RuntimeException($msg);
}
$len = current(unpack('S', fread($fp, 2)));
fseek(... | [
"public",
"function",
"getStream",
"(",
")",
"{",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"'rb'",
")",
";",
"if",
"(",
"$",
"fp",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
"\"Cannot retrieve QTI File Stream fr... | Get a stream resource on the file.
@throws \RuntimeException If the stream on the file cannot be open.
@return resource An open stream. | [
"Get",
"a",
"stream",
"resource",
"on",
"the",
"file",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/files/FileSystemFile.php#L184-L200 |
oat-sa/qti-sdk | src/qtism/common/datatypes/files/FileSystemFile.php | FileSystemFile.createFromExistingFile | public static function createFromExistingFile($source, $destination, $mimeType, $withFilename = true)
{
if (is_file($source) === true) {
if (is_readable($source) === true) {
// Should we build the path to $destination?
$pathinfo = pathinfo($destination);
... | php | public static function createFromExistingFile($source, $destination, $mimeType, $withFilename = true)
{
if (is_file($source) === true) {
if (is_readable($source) === true) {
// Should we build the path to $destination?
$pathinfo = pathinfo($destination);
... | [
"public",
"static",
"function",
"createFromExistingFile",
"(",
"$",
"source",
",",
"$",
"destination",
",",
"$",
"mimeType",
",",
"$",
"withFilename",
"=",
"true",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"source",
")",
"===",
"true",
")",
"{",
"if",
... | Create a PersistentFile object from an existing file.
@param string $source The source path.
@param string $destination Where the file resulting from $source will be stored.
@param string $mimeType The MIME type of the file.
@param mixed $withFilename Whether or not consider the $source's filename to be the $destinati... | [
"Create",
"a",
"PersistentFile",
"object",
"from",
"an",
"existing",
"file",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/files/FileSystemFile.php#L212-L276 |
oat-sa/qti-sdk | src/qtism/common/datatypes/files/FileSystemFile.php | FileSystemFile.createFromData | public static function createFromData($data, $destination, $mimeType, $filename = '')
{
$tmp = tempnam('/tmp', 'qtism');
file_put_contents($tmp, $data);
$file = self::createFromExistingFile($tmp, $destination, $mimeType, $filename);
unlink($tmp);
return $file;
} | php | public static function createFromData($data, $destination, $mimeType, $filename = '')
{
$tmp = tempnam('/tmp', 'qtism');
file_put_contents($tmp, $data);
$file = self::createFromExistingFile($tmp, $destination, $mimeType, $filename);
unlink($tmp);
return $file;
} | [
"public",
"static",
"function",
"createFromData",
"(",
"$",
"data",
",",
"$",
"destination",
",",
"$",
"mimeType",
",",
"$",
"filename",
"=",
"''",
")",
"{",
"$",
"tmp",
"=",
"tempnam",
"(",
"'/tmp'",
",",
"'qtism'",
")",
";",
"file_put_contents",
"(",
... | Create a File from existing data.
@param string $data
@param string $destination
@param string $mimeType
@param string $filename
@return \qtism\common\datatypes\files\FileSystemFile | [
"Create",
"a",
"File",
"from",
"existing",
"data",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/files/FileSystemFile.php#L287-L296 |
oat-sa/qti-sdk | src/qtism/common/datatypes/files/FileSystemFile.php | FileSystemFile.equals | public function equals($obj)
{
if ($obj instanceof QtiFile) {
if ($this->getFilename() !== $obj->getFilename()) {
return false;
} elseif ($this->getMimeType() !== $obj->getMimeType()) {
return false;
} else {
// We have to c... | php | public function equals($obj)
{
if ($obj instanceof QtiFile) {
if ($this->getFilename() !== $obj->getFilename()) {
return false;
} elseif ($this->getMimeType() !== $obj->getMimeType()) {
return false;
} else {
// We have to c... | [
"public",
"function",
"equals",
"(",
"$",
"obj",
")",
"{",
"if",
"(",
"$",
"obj",
"instanceof",
"QtiFile",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getFilename",
"(",
")",
"!==",
"$",
"obj",
"->",
"getFilename",
"(",
")",
")",
"{",
"return",
"false... | Whether or not two File objects are equals. Two File values
are considered to be identical if they have the same file name,
mime-type and data.
@return boolean | [
"Whether",
"or",
"not",
"two",
"File",
"objects",
"are",
"equals",
".",
"Two",
"File",
"values",
"are",
"considered",
"to",
"be",
"identical",
"if",
"they",
"have",
"the",
"same",
"file",
"name",
"mime",
"-",
"type",
"and",
"data",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/files/FileSystemFile.php#L347-L379 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/DivideProcessor.php | DivideProcessor.process | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The Divide operator only accepts operands with a single cardinality.";
... | php | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The Divide operator only accepts operands with a single cardinality.";
... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"if",
"(",
"$",
"operands",
"->",
"containsNull",
"(",
")",
"===",
"true",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
... | Process the Divide operator.
@return float|null A float value that corresponds to the first expression divided by the second or NULL if either of the sub-expressions is NULL or the result is outside the value set defined by float.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException | [
"Process",
"the",
"Divide",
"operator",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/DivideProcessor.php#L56-L84 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/MathOperatorMarshaller.php | MathOperatorMarshaller.unmarshallChildrenKnown | protected function unmarshallChildrenKnown(DOMElement $element, QtiComponentCollection $children)
{
if (($name = $this->getDOMElementAttributeAs($element, 'name')) !== null) {
$object = new MathOperator($children, MathFunctions::getConstantByName($name));
return $object;
} ... | php | protected function unmarshallChildrenKnown(DOMElement $element, QtiComponentCollection $children)
{
if (($name = $this->getDOMElementAttributeAs($element, 'name')) !== null) {
$object = new MathOperator($children, MathFunctions::getConstantByName($name));
return $object;
} ... | [
"protected",
"function",
"unmarshallChildrenKnown",
"(",
"DOMElement",
"$",
"element",
",",
"QtiComponentCollection",
"$",
"children",
")",
"{",
"if",
"(",
"(",
"$",
"name",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'name'",
... | Unmarshall a QTI mathOperator operator element into a MathsOperator object.
@param \DOMElement $element The mathOperator element to unmarshall.
@param \qtism\data\QtiComponentCollection $children A collection containing the child Expression objects composing the Operator.
@return \qtism\data\QtiComponent A MathOperato... | [
"Unmarshall",
"a",
"QTI",
"mathOperator",
"operator",
"element",
"into",
"a",
"MathsOperator",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/MathOperatorMarshaller.php#L68-L79 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/RandomFloatProcessor.php | RandomFloatProcessor.process | public function process()
{
$expr = $this->getExpression();
$min = $expr->getMin();
$max = $expr->getMax();
$state = $this->getState();
$min = (is_float($min)) ? $min : $state[Utils::sanitizeVariableRef($min)]->getValue();
$max = (is_float($max)) ? $max : $state[Uti... | php | public function process()
{
$expr = $this->getExpression();
$min = $expr->getMin();
$max = $expr->getMax();
$state = $this->getState();
$min = (is_float($min)) ? $min : $state[Utils::sanitizeVariableRef($min)]->getValue();
$max = (is_float($max)) ? $max : $state[Uti... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"expr",
"=",
"$",
"this",
"->",
"getExpression",
"(",
")",
";",
"$",
"min",
"=",
"$",
"expr",
"->",
"getMin",
"(",
")",
";",
"$",
"max",
"=",
"$",
"expr",
"->",
"getMax",
"(",
")",
";",
"$",
... | Process the RandomFloat expression.
* Throws an ExpressionProcessingException if 'min' is greater than 'max'.
@return float A Random float value.
@throws \qtism\runtime\expressions\ExpressionProcessingException | [
"Process",
"the",
"RandomFloat",
"expression",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/RandomFloatProcessor.php#L50-L73 |
oat-sa/qti-sdk | src/qtism/runtime/processing/OutcomeProcessingEngine.php | OutcomeProcessingEngine.setComponent | public function setComponent(QtiComponent $outcomeProcessing)
{
if ($outcomeProcessing instanceof OutcomeProcessing) {
parent::setComponent($outcomeProcessing);
} else {
$msg = "The OutcomeProcessingEngine class only accepts OutcomeProcessing objects to be executed.";
... | php | public function setComponent(QtiComponent $outcomeProcessing)
{
if ($outcomeProcessing instanceof OutcomeProcessing) {
parent::setComponent($outcomeProcessing);
} else {
$msg = "The OutcomeProcessingEngine class only accepts OutcomeProcessing objects to be executed.";
... | [
"public",
"function",
"setComponent",
"(",
"QtiComponent",
"$",
"outcomeProcessing",
")",
"{",
"if",
"(",
"$",
"outcomeProcessing",
"instanceof",
"OutcomeProcessing",
")",
"{",
"parent",
"::",
"setComponent",
"(",
"$",
"outcomeProcessing",
")",
";",
"}",
"else",
... | Set the OutcomeProcessing object to be executed by the engine depending
on the current context.
@param \qtism\data\QtiComponent $outcomeProcessing An OutcomeProcessing object.
@throws \InvalidArgumentException If $outcomeProcessing is not An OutcomeProcessing object. | [
"Set",
"the",
"OutcomeProcessing",
"object",
"to",
"be",
"executed",
"by",
"the",
"engine",
"depending",
"on",
"the",
"current",
"context",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/processing/OutcomeProcessingEngine.php#L90-L98 |
oat-sa/qti-sdk | src/qtism/data/Utils.php | Utils.checkRecursion | private static function checkRecursion($component, $sections)
{
$sectparent = null;
foreach ($sections as $key => $sect) {
if (in_array($component, $sect->getSectionParts()->getArrayCopy())) {
$sectparent = $sect;
}
if ($sect->getIdentifier() =... | php | private static function checkRecursion($component, $sections)
{
$sectparent = null;
foreach ($sections as $key => $sect) {
if (in_array($component, $sect->getSectionParts()->getArrayCopy())) {
$sectparent = $sect;
}
if ($sect->getIdentifier() =... | [
"private",
"static",
"function",
"checkRecursion",
"(",
"$",
"component",
",",
"$",
"sections",
")",
"{",
"$",
"sectparent",
"=",
"null",
";",
"foreach",
"(",
"$",
"sections",
"as",
"$",
"key",
"=>",
"$",
"sect",
")",
"{",
"if",
"(",
"in_array",
"(",
... | Checks if the current section has a parent, and returns it, if any.
Gets the list of sections of this AssessmentTest, and checks if any has the AssessmentSection
set as parameter in its components. If some has, we keep the last section found (to take the
closest parent).
@param $component AssessmentSection The sectio... | [
"Checks",
"if",
"the",
"current",
"section",
"has",
"a",
"parent",
"and",
"returns",
"it",
"if",
"any",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/Utils.php#L39-L56 |
oat-sa/qti-sdk | src/qtism/data/Utils.php | Utils.getFirstItem | public static function getFirstItem($test, $component, $sections)
{
$currentCmp = $component;
$visitedNodes = [];
while (true) {
$visitedNodes[] = $currentCmp->getIdentifier();
switch ($currentCmp->getQtiClassName()) {
case "assessmentItemRef":
... | php | public static function getFirstItem($test, $component, $sections)
{
$currentCmp = $component;
$visitedNodes = [];
while (true) {
$visitedNodes[] = $currentCmp->getIdentifier();
switch ($currentCmp->getQtiClassName()) {
case "assessmentItemRef":
... | [
"public",
"static",
"function",
"getFirstItem",
"(",
"$",
"test",
",",
"$",
"component",
",",
"$",
"sections",
")",
"{",
"$",
"currentCmp",
"=",
"$",
"component",
";",
"$",
"visitedNodes",
"=",
"[",
"]",
";",
"while",
"(",
"true",
")",
"{",
"$",
"vis... | Returns the first AssessmentItem that will be prompted if a branch targets the
QtiComponent set as parameter.
This method depends heavily of the QtiClass of the QtiComponent. Some require multiples loops where we need to
find the firstItem from another QtiComponent : this is then done iteratively.
@param $test \qtism... | [
"Returns",
"the",
"first",
"AssessmentItem",
"that",
"will",
"be",
"prompted",
"if",
"a",
"branch",
"targets",
"the",
"QtiComponent",
"set",
"as",
"parameter",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/Utils.php#L73-L184 |
oat-sa/qti-sdk | src/qtism/data/Utils.php | Utils.getLastItem | public static function getLastItem($test, $component, $sections)
{
$currentCmp = $component;
// $sections = null;
while (true)
{
switch ($currentCmp->getQtiClassName()) {
case "assessmentItemRef":
return $currentCmp;
... | php | public static function getLastItem($test, $component, $sections)
{
$currentCmp = $component;
// $sections = null;
while (true)
{
switch ($currentCmp->getQtiClassName()) {
case "assessmentItemRef":
return $currentCmp;
... | [
"public",
"static",
"function",
"getLastItem",
"(",
"$",
"test",
",",
"$",
"component",
",",
"$",
"sections",
")",
"{",
"$",
"currentCmp",
"=",
"$",
"component",
";",
"// $sections = null;",
"while",
"(",
"true",
")",
"{",
"switch",
"(",
"$",
"currentCmp",... | Returns the last AssessmentItem that will be prompted before a BranchRule of the QtiComponent set as parameter
will be taken.
This method depends heavily of the QtiClass of the QtiComponent. Some require multiples loops where we need to
find the lastItem from another QtiComponent : this is then done iteratively.
@par... | [
"Returns",
"the",
"last",
"AssessmentItem",
"that",
"will",
"be",
"prompted",
"before",
"a",
"BranchRule",
"of",
"the",
"QtiComponent",
"set",
"as",
"parameter",
"will",
"be",
"taken",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/Utils.php#L201-L299 |
oat-sa/qti-sdk | src/qtism/data/state/AreaMapping.php | AreaMapping.setUpperBound | public function setUpperBound($upperBound)
{
if (is_float($upperBound) || (is_bool($upperBound) && $upperBound === false)) {
$this->upperBound = $upperBound;
} else {
$msg = "The upperBound argument must be a float or false if no upper bound, '" . gettype($upperBound) . "' gi... | php | public function setUpperBound($upperBound)
{
if (is_float($upperBound) || (is_bool($upperBound) && $upperBound === false)) {
$this->upperBound = $upperBound;
} else {
$msg = "The upperBound argument must be a float or false if no upper bound, '" . gettype($upperBound) . "' gi... | [
"public",
"function",
"setUpperBound",
"(",
"$",
"upperBound",
")",
"{",
"if",
"(",
"is_float",
"(",
"$",
"upperBound",
")",
"||",
"(",
"is_bool",
"(",
"$",
"upperBound",
")",
"&&",
"$",
"upperBound",
"===",
"false",
")",
")",
"{",
"$",
"this",
"->",
... | Set the upper bound.
@param boolean|float $upperBound An upper bound.
@throws \InvalidArgumentException If $upperBound is not a float value nor false. | [
"Set",
"the",
"upper",
"bound",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/AreaMapping.php#L124-L132 |
oat-sa/qti-sdk | src/qtism/data/state/AreaMapping.php | AreaMapping.setDefaultValue | public function setDefaultValue($defaultValue)
{
if (is_float($defaultValue)) {
$this->defaultValue = $defaultValue;
} else {
$msg = "The defaultValue argument must be a numeric value, '" . gettype($defaultValue) . "'.";
throw new InvalidArgumentException($msg);
... | php | public function setDefaultValue($defaultValue)
{
if (is_float($defaultValue)) {
$this->defaultValue = $defaultValue;
} else {
$msg = "The defaultValue argument must be a numeric value, '" . gettype($defaultValue) . "'.";
throw new InvalidArgumentException($msg);
... | [
"public",
"function",
"setDefaultValue",
"(",
"$",
"defaultValue",
")",
"{",
"if",
"(",
"is_float",
"(",
"$",
"defaultValue",
")",
")",
"{",
"$",
"this",
"->",
"defaultValue",
"=",
"$",
"defaultValue",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The defau... | Set the default value.
@param float $defaultValue A default value.
@throws \InvalidArgumentException If $defaultValue is not a float value. | [
"Set",
"the",
"default",
"value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/AreaMapping.php#L150-L158 |
oat-sa/qti-sdk | src/qtism/data/state/AreaMapping.php | AreaMapping.setAreaMapEntries | public function setAreaMapEntries(AreaMapEntryCollection $areaMapEntries)
{
if (count($areaMapEntries) >= 1) {
$this->areaMapEntries = $areaMapEntries;
} else {
$msg = "An AreaMapping object must contain at least one AreaMapEntry object. none given.";
throw new In... | php | public function setAreaMapEntries(AreaMapEntryCollection $areaMapEntries)
{
if (count($areaMapEntries) >= 1) {
$this->areaMapEntries = $areaMapEntries;
} else {
$msg = "An AreaMapping object must contain at least one AreaMapEntry object. none given.";
throw new In... | [
"public",
"function",
"setAreaMapEntries",
"(",
"AreaMapEntryCollection",
"$",
"areaMapEntries",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"areaMapEntries",
")",
">=",
"1",
")",
"{",
"$",
"this",
"->",
"areaMapEntries",
"=",
"$",
"areaMapEntries",
";",
"}",
"e... | Set the collection of AreaMapEntry objects composing the AreaMapping.
@param \qtism\data\state\AreaMapEntryCollection $areaMapEntries A collection of AreaMapEntry objects. | [
"Set",
"the",
"collection",
"of",
"AreaMapEntry",
"objects",
"composing",
"the",
"AreaMapping",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/AreaMapping.php#L175-L183 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.