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/expressions/operators/EqualRounded.php | EqualRounded.setFigures | public function setFigures($figures)
{
if (is_int($figures) || (gettype($figures) === 'string' && Format::isVariableRef($figures))) {
$this->figures = $figures;
} else {
$msg = "The figures argument must be an integer or a variable reference, '" . $figures . "' given.";
... | php | public function setFigures($figures)
{
if (is_int($figures) || (gettype($figures) === 'string' && Format::isVariableRef($figures))) {
$this->figures = $figures;
} else {
$msg = "The figures argument must be an integer or a variable reference, '" . $figures . "' given.";
... | [
"public",
"function",
"setFigures",
"(",
"$",
"figures",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"figures",
")",
"||",
"(",
"gettype",
"(",
"$",
"figures",
")",
"===",
"'string'",
"&&",
"Format",
"::",
"isVariableRef",
"(",
"$",
"figures",
")",
")",
... | Set the number of figures to round to.
@param integer|string $figures An integer value or a variable reference.
@throws \InvalidArgumentException If $figures is not an integer nor a variable reference. | [
"Set",
"the",
"number",
"of",
"figures",
"to",
"round",
"to",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/expressions/operators/EqualRounded.php#L113-L121 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.createFinalRendering | protected function createFinalRendering(QtiComponent $component)
{
$dom = $this->getDocument();
if (($last = $this->getLastRendering()) !== null) {
$dom->appendChild($last);
}
// If we are rendering an item, let's try to find some Math to
// for template variable... | php | protected function createFinalRendering(QtiComponent $component)
{
$dom = $this->getDocument();
if (($last = $this->getLastRendering()) !== null) {
$dom->appendChild($last);
}
// If we are rendering an item, let's try to find some Math to
// for template variable... | [
"protected",
"function",
"createFinalRendering",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"dom",
"=",
"$",
"this",
"->",
"getDocument",
"(",
")",
";",
"if",
"(",
"(",
"$",
"last",
"=",
"$",
"this",
"->",
"getLastRendering",
"(",
")",
")",
... | Create the final rendering of the rendered $component as it must be rendered by the final
implementation.
@return mixed | [
"Create",
"the",
"final",
"rendering",
"of",
"the",
"rendered",
"$component",
"as",
"it",
"must",
"be",
"rendered",
"by",
"the",
"final",
"implementation",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L561-L612 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.processNode | protected function processNode($base = '')
{
$component = $this->getExploredComponent();
$renderer = $this->getRenderer($component);
$rendering = $renderer->render($component, $base);
if ($this->mustTemplateFeedbackComponent($component) === true) {
$this->templateFeedbac... | php | protected function processNode($base = '')
{
$component = $this->getExploredComponent();
$renderer = $this->getRenderer($component);
$rendering = $renderer->render($component, $base);
if ($this->mustTemplateFeedbackComponent($component) === true) {
$this->templateFeedbac... | [
"protected",
"function",
"processNode",
"(",
"$",
"base",
"=",
"''",
")",
"{",
"$",
"component",
"=",
"$",
"this",
"->",
"getExploredComponent",
"(",
")",
";",
"$",
"renderer",
"=",
"$",
"this",
"->",
"getRenderer",
"(",
"$",
"component",
")",
";",
"$"... | Process the current node (Ascending phase).
@param string $base the value of xml:base for the node to be processed.
@throws RenderingException If an error occurs while processing the node. | [
"Process",
"the",
"current",
"node",
"(",
"Ascending",
"phase",
")",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L620-L643 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.mustIgnoreComponent | protected function mustIgnoreComponent(QtiComponent $component)
{
// In the list of QTI class names to be ignored?
if (in_array($component->getQtiClassName(), $this->getIgnoreClasses()) === true) {
return true;
}
// Context Aware + FeedbackElement OR Context Aware + Choic... | php | protected function mustIgnoreComponent(QtiComponent $component)
{
// In the list of QTI class names to be ignored?
if (in_array($component->getQtiClassName(), $this->getIgnoreClasses()) === true) {
return true;
}
// Context Aware + FeedbackElement OR Context Aware + Choic... | [
"protected",
"function",
"mustIgnoreComponent",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"// In the list of QTI class names to be ignored?",
"if",
"(",
"in_array",
"(",
"$",
"component",
"->",
"getQtiClassName",
"(",
")",
",",
"$",
"this",
"->",
"getIgnoreClas... | Whether or not a component must be ignored or not while rendering. The following cases
makes a component to be ignored:
* The ChoiceHideShow policy is set to CONTEXT_AWARE and the variable referenced by the Choice's templateIdentifier attribute does not match the expected value.
* The FeedbackHideShow policy is set to... | [
"Whether",
"or",
"not",
"a",
"component",
"must",
"be",
"ignored",
"or",
"not",
"while",
"rendering",
".",
"The",
"following",
"cases",
"makes",
"a",
"component",
"to",
"be",
"ignored",
":"
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L656-L686 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.identifierMatches | protected function identifierMatches(QtiComponent $component)
{
$variableIdentifier = ($component instanceof FeedbackElement || $component instanceof ModalFeedback) ? $component->getOutcomeIdentifier() : $component->getTemplateIdentifier();
$identifier = new QtiIdentifier($component->getIdentifier()... | php | protected function identifierMatches(QtiComponent $component)
{
$variableIdentifier = ($component instanceof FeedbackElement || $component instanceof ModalFeedback) ? $component->getOutcomeIdentifier() : $component->getTemplateIdentifier();
$identifier = new QtiIdentifier($component->getIdentifier()... | [
"protected",
"function",
"identifierMatches",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"variableIdentifier",
"=",
"(",
"$",
"component",
"instanceof",
"FeedbackElement",
"||",
"$",
"component",
"instanceof",
"ModalFeedback",
")",
"?",
"$",
"component",
... | Whether or not the 'outcomeIdentifier'/'templateIdentifier' set on a templateElement/feedbackElement/choice
matches its 'identifier' attribute.
@param QtiComponent $component A TemplateElement or FeedbackElement or Choice element.
@return boolean | [
"Whether",
"or",
"not",
"the",
"outcomeIdentifier",
"/",
"templateIdentifier",
"set",
"on",
"a",
"templateElement",
"/",
"feedbackElement",
"/",
"choice",
"matches",
"its",
"identifier",
"attribute",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L695-L713 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.registerRenderer | public function registerRenderer($qtiClassName, AbstractMarkupRenderer $renderer, $ns = 'qtism')
{
$renderer->setRenderingEngine($this);
$renderers = $this->getRenderers();
$renderers[$ns][$qtiClassName] = $renderer;
$this->setRenderers($renderers);
} | php | public function registerRenderer($qtiClassName, AbstractMarkupRenderer $renderer, $ns = 'qtism')
{
$renderer->setRenderingEngine($this);
$renderers = $this->getRenderers();
$renderers[$ns][$qtiClassName] = $renderer;
$this->setRenderers($renderers);
} | [
"public",
"function",
"registerRenderer",
"(",
"$",
"qtiClassName",
",",
"AbstractMarkupRenderer",
"$",
"renderer",
",",
"$",
"ns",
"=",
"'qtism'",
")",
"{",
"$",
"renderer",
"->",
"setRenderingEngine",
"(",
"$",
"this",
")",
";",
"$",
"renderers",
"=",
"$",... | Register a $renderer object to a given $qtiClassName.
@param string $qtiClassName A QTI class name.
@param \qtism\runtime\rendering\markup\AbstractMarkupRenderer $renderer An AbstractRenderer object.
@param string $ns | [
"Register",
"a",
"$renderer",
"object",
"to",
"a",
"given",
"$qtiClassName",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L770-L776 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.getRenderer | public function getRenderer(QtiComponent $component)
{
$renderers = $this->getRenderers();
$className = $component->getQtiClassName();
if ($component instanceof ExternalQtiComponent && isset($renderers[$component->getTargetNamespace()][$className])) {
return $renderers[$componen... | php | public function getRenderer(QtiComponent $component)
{
$renderers = $this->getRenderers();
$className = $component->getQtiClassName();
if ($component instanceof ExternalQtiComponent && isset($renderers[$component->getTargetNamespace()][$className])) {
return $renderers[$componen... | [
"public",
"function",
"getRenderer",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"renderers",
"=",
"$",
"this",
"->",
"getRenderers",
"(",
")",
";",
"$",
"className",
"=",
"$",
"component",
"->",
"getQtiClassName",
"(",
")",
";",
"if",
"(",
"$"... | Get the AbstractRenderer implementation which is appropriate to render the given
QtiComponent $component.
@param QtiComponent $component A QtiComponent object you want to get the appropriate AbstractRenderer implementation.
@throws RenderingException If no implementation of AbstractRenderer is registered for $componen... | [
"Get",
"the",
"AbstractRenderer",
"implementation",
"which",
"is",
"appropriate",
"to",
"render",
"the",
"given",
"QtiComponent",
"$component",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L786-L799 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.getChildrenRenderings | public function getChildrenRenderings(QtiComponent $component)
{
$returnValue = array();
foreach (array_reverse($component->getComponents()->getArrayCopy()) as $c) {
if (count($this->getRenderingStack()) > 0) {
list($renderedComponent, $rendering) = $this->getRenderingS... | php | public function getChildrenRenderings(QtiComponent $component)
{
$returnValue = array();
foreach (array_reverse($component->getComponents()->getArrayCopy()) as $c) {
if (count($this->getRenderingStack()) > 0) {
list($renderedComponent, $rendering) = $this->getRenderingS... | [
"public",
"function",
"getChildrenRenderings",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"returnValue",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"array_reverse",
"(",
"$",
"component",
"->",
"getComponents",
"(",
")",
"->",
"getArrayCopy",
"(",... | Get the renderings related to the children of $component.
@param QtiComponent $component A QtiComponent object to be rendered.
@return array | [
"Get",
"the",
"renderings",
"related",
"to",
"the",
"children",
"of",
"$component",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L863-L882 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.reset | public function reset()
{
$this->choiceCounter = 0;
$this->setExploration(new SplStack());
$this->setExplorationMarker(array());
$this->setLastRendering(null);
$this->setRenderingStack(new SplStack());
$this->setXmlBaseStack(new SplStack());
$this->setDocument... | php | public function reset()
{
$this->choiceCounter = 0;
$this->setExploration(new SplStack());
$this->setExplorationMarker(array());
$this->setLastRendering(null);
$this->setRenderingStack(new SplStack());
$this->setXmlBaseStack(new SplStack());
$this->setDocument... | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"choiceCounter",
"=",
"0",
";",
"$",
"this",
"->",
"setExploration",
"(",
"new",
"SplStack",
"(",
")",
")",
";",
"$",
"this",
"->",
"setExplorationMarker",
"(",
"array",
"(",
")",
")",
... | Reset the engine to its initial state, in order
to be ready for reuse i.e. render a new component. However,
configuration such as policies are kept intact. | [
"Reset",
"the",
"engine",
"to",
"its",
"initial",
"state",
"in",
"order",
"to",
"be",
"ready",
"for",
"reuse",
"i",
".",
"e",
".",
"render",
"a",
"new",
"component",
".",
"However",
"configuration",
"such",
"as",
"policies",
"are",
"kept",
"intact",
"."
... | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L889-L900 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.registerXmlBase | protected function registerXmlBase($substitution = '')
{
$c = $this->getExploredComponent();
$toPush = $substitution;
if ($c instanceof Flow) {
if (empty($substitution) === true) {
$toPush = $c->getXmlBase();
}
}
$this... | php | protected function registerXmlBase($substitution = '')
{
$c = $this->getExploredComponent();
$toPush = $substitution;
if ($c instanceof Flow) {
if (empty($substitution) === true) {
$toPush = $c->getXmlBase();
}
}
$this... | [
"protected",
"function",
"registerXmlBase",
"(",
"$",
"substitution",
"=",
"''",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"getExploredComponent",
"(",
")",
";",
"$",
"toPush",
"=",
"$",
"substitution",
";",
"if",
"(",
"$",
"c",
"instanceof",
"Flow",
... | Register the value of xml:base of the currently explored component
into the xmlBaseStack.
@param string $substitution If set, the registered xml:base value will be the value of the argument instead of the currently explored component's xml:base value. | [
"Register",
"the",
"value",
"of",
"xml",
":",
"base",
"of",
"the",
"currently",
"explored",
"component",
"into",
"the",
"xmlBaseStack",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L908-L920 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.resolveXmlBase | protected function resolveXmlBase()
{
$stack = $this->getXmlBaseStack();
$stack->rewind();
$resolvedBase = '';
while ($stack->valid() === true) {
if (($currentBase = $stack->current()) !== '') {
if ($resolvedBase === '') {
$resolvedB... | php | protected function resolveXmlBase()
{
$stack = $this->getXmlBaseStack();
$stack->rewind();
$resolvedBase = '';
while ($stack->valid() === true) {
if (($currentBase = $stack->current()) !== '') {
if ($resolvedBase === '') {
$resolvedB... | [
"protected",
"function",
"resolveXmlBase",
"(",
")",
"{",
"$",
"stack",
"=",
"$",
"this",
"->",
"getXmlBaseStack",
"(",
")",
";",
"$",
"stack",
"->",
"rewind",
"(",
")",
";",
"$",
"resolvedBase",
"=",
"''",
";",
"while",
"(",
"$",
"stack",
"->",
"val... | Resolve what is the base URL to be used for the currently explored component.
@return string A URL or the empty string ('') if no base URL could be resolved. | [
"Resolve",
"what",
"is",
"the",
"base",
"URL",
"to",
"be",
"used",
"for",
"the",
"currently",
"explored",
"component",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L927-L952 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.mustTemplateFeedbackComponent | protected function mustTemplateFeedbackComponent(QtiComponent $component)
{
return (self::isFeedback($component) && $this->getFeedbackShowHidePolicy() === AbstractMarkupRenderingEngine::TEMPLATE_ORIENTED);
} | php | protected function mustTemplateFeedbackComponent(QtiComponent $component)
{
return (self::isFeedback($component) && $this->getFeedbackShowHidePolicy() === AbstractMarkupRenderingEngine::TEMPLATE_ORIENTED);
} | [
"protected",
"function",
"mustTemplateFeedbackComponent",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"return",
"(",
"self",
"::",
"isFeedback",
"(",
"$",
"component",
")",
"&&",
"$",
"this",
"->",
"getFeedbackShowHidePolicy",
"(",
")",
"===",
"AbstractMarkup... | Whether or not a given component (expected to be a feedback) must be templated. A component
is considered to be templatable if:
* it is an instance of FeedbackElement or ModalFeedback
* the current policy for feedback elements is TEMPLATE_ORIENTED
@param QtiComponent $component
@return boolean | [
"Whether",
"or",
"not",
"a",
"given",
"component",
"(",
"expected",
"to",
"be",
"a",
"feedback",
")",
"must",
"be",
"templated",
".",
"A",
"component",
"is",
"considered",
"to",
"be",
"templatable",
"if",
":"
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L964-L967 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.mustTemplateRubricBlockComponent | protected function mustTemplateRubricBlockComponent(QtiComponent $component)
{
return (self::isRubricBlock($component) && $this->getViewPolicy() === AbstractMarkupRenderingEngine::TEMPLATE_ORIENTED);
} | php | protected function mustTemplateRubricBlockComponent(QtiComponent $component)
{
return (self::isRubricBlock($component) && $this->getViewPolicy() === AbstractMarkupRenderingEngine::TEMPLATE_ORIENTED);
} | [
"protected",
"function",
"mustTemplateRubricBlockComponent",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"return",
"(",
"self",
"::",
"isRubricBlock",
"(",
"$",
"component",
")",
"&&",
"$",
"this",
"->",
"getViewPolicy",
"(",
")",
"===",
"AbstractMarkupRender... | Whether or not a given component (expected to be a rubricBlock) must be templated. A component
is considered to be templatable if:
* it is an instance of RubricBlock
* the current policy for views is TEMPLATE_ORIENTED
@param QtiComponent $component
@return boolean | [
"Whether",
"or",
"not",
"a",
"given",
"component",
"(",
"expected",
"to",
"be",
"a",
"rubricBlock",
")",
"must",
"be",
"templated",
".",
"A",
"component",
"is",
"considered",
"to",
"be",
"templatable",
"if",
":"
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L979-L982 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.mustTemplateChoiceComponent | protected function mustTemplateChoiceComponent(QtiComponent $component)
{
return self::isChoice($component) && $this->getChoiceShowHidePolicy() === self::TEMPLATE_ORIENTED && $component->hasTemplateIdentifier();
} | php | protected function mustTemplateChoiceComponent(QtiComponent $component)
{
return self::isChoice($component) && $this->getChoiceShowHidePolicy() === self::TEMPLATE_ORIENTED && $component->hasTemplateIdentifier();
} | [
"protected",
"function",
"mustTemplateChoiceComponent",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"return",
"self",
"::",
"isChoice",
"(",
"$",
"component",
")",
"&&",
"$",
"this",
"->",
"getChoiceShowHidePolicy",
"(",
")",
"===",
"self",
"::",
"TEMPLATE_... | Whether or not a given component (expected to be a choice) must be templated. A component is
considered to be templatable if:
* it is an instance of Choice
* the current policy for choice show/hide is TEMPLATE_ORIENTED
@param QtiComponent $component
@return boolean | [
"Whether",
"or",
"not",
"a",
"given",
"component",
"(",
"expected",
"to",
"be",
"a",
"choice",
")",
"must",
"be",
"templated",
".",
"A",
"component",
"is",
"considered",
"to",
"be",
"templatable",
"if",
":"
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L994-L997 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.templateFeedbackComponent | protected function templateFeedbackComponent(QtiComponent $component, DOMDocumentFragment $rendering)
{
if (self::isFeedback($component) === false) {
$msg = "Cannot template a component which is not an instance of FeedbackElement nor ModalFeedback.";
throw new RenderingException($msg... | php | protected function templateFeedbackComponent(QtiComponent $component, DOMDocumentFragment $rendering)
{
if (self::isFeedback($component) === false) {
$msg = "Cannot template a component which is not an instance of FeedbackElement nor ModalFeedback.";
throw new RenderingException($msg... | [
"protected",
"function",
"templateFeedbackComponent",
"(",
"QtiComponent",
"$",
"component",
",",
"DOMDocumentFragment",
"$",
"rendering",
")",
"{",
"if",
"(",
"self",
"::",
"isFeedback",
"(",
"$",
"component",
")",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
... | Contains the logic of templating a QTI feedback (feedbackElement, modalFeedback).
@param QtiComponent $component The QtiComponent being rendered.
@param DOMDocumentFragment $rendering The rendering corresponding to $component.
@throws RenderingException If $component is not an instance of FeedbackElement nor ModalFeed... | [
"Contains",
"the",
"logic",
"of",
"templating",
"a",
"QTI",
"feedback",
"(",
"feedbackElement",
"modalFeedback",
")",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L1056-L1081 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php | AbstractMarkupRenderingEngine.templateRubricBlockComponent | protected function templateRubricBlockComponent(QtiComponent $component, DOMDocumentFragment $rendering)
{
if (self::isRubricBlock($component) === false) {
$msg = "Cannot template a component which is not an instance of RubricBlock.";
throw new RenderingException($msg, RenderingExcep... | php | protected function templateRubricBlockComponent(QtiComponent $component, DOMDocumentFragment $rendering)
{
if (self::isRubricBlock($component) === false) {
$msg = "Cannot template a component which is not an instance of RubricBlock.";
throw new RenderingException($msg, RenderingExcep... | [
"protected",
"function",
"templateRubricBlockComponent",
"(",
"QtiComponent",
"$",
"component",
",",
"DOMDocumentFragment",
"$",
"rendering",
")",
"{",
"if",
"(",
"self",
"::",
"isRubricBlock",
"(",
"$",
"component",
")",
"===",
"false",
")",
"{",
"$",
"msg",
... | Contains the logic of templating a QTI rubricBlock (RubricBlock).
@param QtiComponent $component The QtiComponent being rendered.
@param DOMDocumentFragment $rendering The rendering corresponding to $component.
@throws RenderingException If $component is not an instance of RubricBlock. | [
"Contains",
"the",
"logic",
"of",
"templating",
"a",
"QTI",
"rubricBlock",
"(",
"RubricBlock",
")",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/markup/AbstractMarkupRenderingEngine.php#L1090-L1114 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/NumberPresentedProcessor.php | NumberPresentedProcessor.process | public function process()
{
$testSession = $this->getState();
$itemSubset = $this->getItemSubset();
$numberPresented = 0;
foreach ($itemSubset as $item) {
$itemSessions = $testSession->getAssessmentItemSessions($item->getIdentifier());
if ($itemS... | php | public function process()
{
$testSession = $this->getState();
$itemSubset = $this->getItemSubset();
$numberPresented = 0;
foreach ($itemSubset as $item) {
$itemSessions = $testSession->getAssessmentItemSessions($item->getIdentifier());
if ($itemS... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"testSession",
"=",
"$",
"this",
"->",
"getState",
"(",
")",
";",
"$",
"itemSubset",
"=",
"$",
"this",
"->",
"getItemSubset",
"(",
")",
";",
"$",
"numberPresented",
"=",
"0",
";",
"foreach",
"(",
"... | Process the related NumberPresented expression.
@return integer The number of items in the given item sub-set that have been attempted (at least once).
@throws \qtism\runtime\expressions\ExpressionProcessingException | [
"Process",
"the",
"related",
"NumberPresented",
"expression",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/NumberPresentedProcessor.php#L52-L73 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/InlineChoiceInteraction.php | InlineChoiceInteraction.setRequired | public function setRequired($required)
{
if (is_bool($required) === true) {
$this->required = $required;
} else {
$msg = "The 'required' argument must be a boolean value, '" . gettype($required) . "' given.";
throw new InvalidArgumentException($msg);
}
... | php | public function setRequired($required)
{
if (is_bool($required) === true) {
$this->required = $required;
} else {
$msg = "The 'required' argument must be a boolean value, '" . gettype($required) . "' given.";
throw new InvalidArgumentException($msg);
}
... | [
"public",
"function",
"setRequired",
"(",
"$",
"required",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"required",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"required",
"=",
"$",
"required",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The 'requir... | Set whether a choice is required to be selected by the candidate.
@param boolean $required
@throws \InvalidArgumentException If $required is not a boolean value. | [
"Set",
"whether",
"a",
"choice",
"is",
"required",
"to",
"be",
"selected",
"by",
"the",
"candidate",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/InlineChoiceInteraction.php#L134-L142 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/InlineChoiceInteraction.php | InlineChoiceInteraction.setContent | public function setContent(InlineChoiceCollection $content)
{
if (count($content) > 0) {
$this->content = $content;
} else {
$msg = "An InlineChoiceInteraction must be composed by at lease one InlineChoice object, none given.";
throw new InvalidArgumentException($... | php | public function setContent(InlineChoiceCollection $content)
{
if (count($content) > 0) {
$this->content = $content;
} else {
$msg = "An InlineChoiceInteraction must be composed by at lease one InlineChoice object, none given.";
throw new InvalidArgumentException($... | [
"public",
"function",
"setContent",
"(",
"InlineChoiceCollection",
"$",
"content",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"content",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"content",
"=",
"$",
"content",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
... | Set the InlineChoice objects composing the interaction.
@param \qtism\data\content\interactions\InlineChoiceCollection $content A collection of at least one InlineChoice object.
@throws \InvalidArgumentException If $content is empty. | [
"Set",
"the",
"InlineChoice",
"objects",
"composing",
"the",
"interaction",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/InlineChoiceInteraction.php#L160-L168 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/Img.php | Img.setSrc | public function setSrc($src)
{
if (Format::isUri($src) === true) {
$this->src = $src;
} else {
$msg = "The 'src' argument must be a valid URI, '" . $src . "' given.";
throw new InvalidArgumentException($msg);
}
} | php | public function setSrc($src)
{
if (Format::isUri($src) === true) {
$this->src = $src;
} else {
$msg = "The 'src' argument must be a valid URI, '" . $src . "' given.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setSrc",
"(",
"$",
"src",
")",
"{",
"if",
"(",
"Format",
"::",
"isUri",
"(",
"$",
"src",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"src",
"=",
"$",
"src",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The 'src' argument... | Set the src attribute.
@param string $src A URI.
@throws \InvalidArgumentException If $src is not a valid URI. | [
"Set",
"the",
"src",
"attribute",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/Img.php#L116-L124 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/Img.php | Img.setAlt | public function setAlt($alt)
{
if (is_string($alt)) {
$this->alt = $alt;
} else {
$msg = "The 'alt' argument must be a string, '" . gettype($alt) . "' given.";
throw new InvalidArgumentException($msg);
}
} | php | public function setAlt($alt)
{
if (is_string($alt)) {
$this->alt = $alt;
} else {
$msg = "The 'alt' argument must be a string, '" . gettype($alt) . "' given.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setAlt",
"(",
"$",
"alt",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"alt",
")",
")",
"{",
"$",
"this",
"->",
"alt",
"=",
"$",
"alt",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The 'alt' argument must be a string, '\"",
".",
"... | Set the alt attribute.
@param string $alt A string
@throws \InvalidArgumentException If $alt is not a string. | [
"Set",
"the",
"alt",
"attribute",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/Img.php#L142-L150 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/Img.php | Img.setLongdesc | public function setLongdesc($longdesc)
{
if (Format::isUri($longdesc) === true || (is_string($longdesc) === true && empty($longdesc) === true)) {
$this->longdesc = $longdesc;
} else {
$msg = "The 'longdesc' argument must be a valid URI, '" . $longdesc . "' given.";
... | php | public function setLongdesc($longdesc)
{
if (Format::isUri($longdesc) === true || (is_string($longdesc) === true && empty($longdesc) === true)) {
$this->longdesc = $longdesc;
} else {
$msg = "The 'longdesc' argument must be a valid URI, '" . $longdesc . "' given.";
... | [
"public",
"function",
"setLongdesc",
"(",
"$",
"longdesc",
")",
"{",
"if",
"(",
"Format",
"::",
"isUri",
"(",
"$",
"longdesc",
")",
"===",
"true",
"||",
"(",
"is_string",
"(",
"$",
"longdesc",
")",
"===",
"true",
"&&",
"empty",
"(",
"$",
"longdesc",
... | Get the longdesc attribute.
@param string $longdesc A valid URI.
@throws \InvalidArgumentException If $longdesc is not a valid URI. | [
"Get",
"the",
"longdesc",
"attribute",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/Img.php#L168-L176 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/Img.php | Img.setHeight | public function setHeight($height)
{
if ((is_int($height) && $height === -1) || Format::isXhtmlLength($height) === true) {
$this->height = $height;
} else {
$msg = "The 'height' argument must be a valid XHTML length value, '" . $height . "' given.";
throw new Inva... | php | public function setHeight($height)
{
if ((is_int($height) && $height === -1) || Format::isXhtmlLength($height) === true) {
$this->height = $height;
} else {
$msg = "The 'height' argument must be a valid XHTML length value, '" . $height . "' given.";
throw new Inva... | [
"public",
"function",
"setHeight",
"(",
"$",
"height",
")",
"{",
"if",
"(",
"(",
"is_int",
"(",
"$",
"height",
")",
"&&",
"$",
"height",
"===",
"-",
"1",
")",
"||",
"Format",
"::",
"isXhtmlLength",
"(",
"$",
"height",
")",
"===",
"true",
")",
"{",
... | Set the height attribute. A negative (< 0) value for $height means there
is no height indicated.
@param integer|string $height An integer (pixels) or a string (percentage).
@throws \InvalidArgumentException If $height is not a valid integer or string value. | [
"Set",
"the",
"height",
"attribute",
".",
"A",
"negative",
"(",
"<",
"0",
")",
"value",
"for",
"$height",
"means",
"there",
"is",
"no",
"height",
"indicated",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/Img.php#L205-L213 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/Img.php | Img.setWidth | public function setWidth($width)
{
if ((is_int($width) && $width === -1) || Format::isXhtmlLength($width) === true) {
$this->width = $width;
} else {
$msg = "The 'width' argument must be a valid XHTML length value, '" . $width . "' given.";
throw new InvalidArgume... | php | public function setWidth($width)
{
if ((is_int($width) && $width === -1) || Format::isXhtmlLength($width) === true) {
$this->width = $width;
} else {
$msg = "The 'width' argument must be a valid XHTML length value, '" . $width . "' given.";
throw new InvalidArgume... | [
"public",
"function",
"setWidth",
"(",
"$",
"width",
")",
"{",
"if",
"(",
"(",
"is_int",
"(",
"$",
"width",
")",
"&&",
"$",
"width",
"===",
"-",
"1",
")",
"||",
"Format",
"::",
"isXhtmlLength",
"(",
"$",
"width",
")",
"===",
"true",
")",
"{",
"$"... | Set the width attribute. A negative (< 0) value for $width means there
is no width indicated.
@param integer $width An integer (pixels) or a string (percentage).
@throws \InvalidArgumentException If $width is not an integer value. | [
"Set",
"the",
"width",
"attribute",
".",
"A",
"negative",
"(",
"<",
"0",
")",
"value",
"for",
"$width",
"means",
"there",
"is",
"no",
"width",
"indicated",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/Img.php#L243-L251 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/GraphicGapMatchInteractionMarshaller.php | GraphicGapMatchInteractionMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
if (($responseIdentifier = $this->getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {
$objectElts = $this->getChildElementsByTagName($element, 'object');
if (count($objectElts) > 0) {
$object = $... | php | protected function unmarshall(DOMElement $element)
{
if (($responseIdentifier = $this->getDOMElementAttributeAs($element, 'responseIdentifier')) !== null) {
$objectElts = $this->getChildElementsByTagName($element, 'object');
if (count($objectElts) > 0) {
$object = $... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"if",
"(",
"(",
"$",
"responseIdentifier",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'responseIdentifier'",
")",
")",
"!==",
"null",
")",
... | Unmarshall a DOMElement object corresponding to a graphicGapMatchInteraction element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A GraphicGapMatchInteraction object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"graphicGapMatchInteraction",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/GraphicGapMatchInteractionMarshaller.php#L46-L108 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/GraphicGapMatchInteractionMarshaller.php | GraphicGapMatchInteractionMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = $this->createElement($component);
$this->fillElement($element, $component);
$this->setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
if ($component->hasPrompt() === true) {
... | php | protected function marshall(QtiComponent $component)
{
$element = $this->createElement($component);
$this->fillElement($element, $component);
$this->setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
if ($component->hasPrompt() === true) {
... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"$",
"this",
"->",
"createElement",
"(",
"$",
"component",
")",
";",
"$",
"this",
"->",
"fillElement",
"(",
"$",
"element",
",",
"$",
"component",
... | Marshall an GraphicGapMatchInteraction object into a DOMElement object.
@param \qtism\data\QtiComponent $component A GraphicGapMatchInteraction object.
@return \DOMElement The according DOMElement object.
@throws \qtism\data\storage\xml\marshalling\MarshallingException | [
"Marshall",
"an",
"GraphicGapMatchInteraction",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/GraphicGapMatchInteractionMarshaller.php#L117-L142 |
oat-sa/qti-sdk | src/qtism/data/state/Value.php | Value.setPartOfRecord | public function setPartOfRecord($partOfRecord)
{
if (is_bool($partOfRecord)) {
$this->isPartOfRecord = $partOfRecord;
} else {
$msg = "The argument must be a boolean, '" . gettype($partOfRecord) . "' given.";
throw new InvalidArgumentException($msg);
}
... | php | public function setPartOfRecord($partOfRecord)
{
if (is_bool($partOfRecord)) {
$this->isPartOfRecord = $partOfRecord;
} else {
$msg = "The argument must be a boolean, '" . gettype($partOfRecord) . "' given.";
throw new InvalidArgumentException($msg);
}
... | [
"public",
"function",
"setPartOfRecord",
"(",
"$",
"partOfRecord",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"partOfRecord",
")",
")",
"{",
"$",
"this",
"->",
"isPartOfRecord",
"=",
"$",
"partOfRecord",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The argu... | Set wether or not the value is part of a record.
@param boolean $partOfRecord
@throws \InvalidArgumentException If $partOfRecord is not a boolean. | [
"Set",
"wether",
"or",
"not",
"the",
"value",
"is",
"part",
"of",
"a",
"record",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/Value.php#L111-L119 |
oat-sa/qti-sdk | src/qtism/data/state/Value.php | Value.setFieldIdentifier | public function setFieldIdentifier($fieldIdentifier)
{
if ($fieldIdentifier == '' || Format::isIdentifier($fieldIdentifier)) {
$this->fieldIdentifier = $fieldIdentifier;
} else {
$msg = "'${fieldIdentifier}' is not a valid QTI identifier.";
throw new InvalidArgume... | php | public function setFieldIdentifier($fieldIdentifier)
{
if ($fieldIdentifier == '' || Format::isIdentifier($fieldIdentifier)) {
$this->fieldIdentifier = $fieldIdentifier;
} else {
$msg = "'${fieldIdentifier}' is not a valid QTI identifier.";
throw new InvalidArgume... | [
"public",
"function",
"setFieldIdentifier",
"(",
"$",
"fieldIdentifier",
")",
"{",
"if",
"(",
"$",
"fieldIdentifier",
"==",
"''",
"||",
"Format",
"::",
"isIdentifier",
"(",
"$",
"fieldIdentifier",
")",
")",
"{",
"$",
"this",
"->",
"fieldIdentifier",
"=",
"$"... | Set the field identifier. An empty string means it is not specified.
@param string $fieldIdentifier A QTI identifier.
@throws \InvalidArgumentException If $fieldIdentifier is not a valid QTI Identifier. | [
"Set",
"the",
"field",
"identifier",
".",
"An",
"empty",
"string",
"means",
"it",
"is",
"not",
"specified",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/Value.php#L147-L155 |
oat-sa/qti-sdk | src/qtism/common/datatypes/QtiShape.php | QtiShape.asArray | public static function asArray()
{
return array(
'DEF' => self::DEF,
'RECT' => self::RECT,
'CIRCLE' => self::CIRCLE,
'POLY' => self::POLY,
'ELLIPSE' => self::ELLIPSE
);
} | php | public static function asArray()
{
return array(
'DEF' => self::DEF,
'RECT' => self::RECT,
'CIRCLE' => self::CIRCLE,
'POLY' => self::POLY,
'ELLIPSE' => self::ELLIPSE
);
} | [
"public",
"static",
"function",
"asArray",
"(",
")",
"{",
"return",
"array",
"(",
"'DEF'",
"=>",
"self",
"::",
"DEF",
",",
"'RECT'",
"=>",
"self",
"::",
"RECT",
",",
"'CIRCLE'",
"=>",
"self",
"::",
"CIRCLE",
",",
"'POLY'",
"=>",
"self",
"::",
"POLY",
... | Get the enumeration as an array.
@return array An associative array. | [
"Get",
"the",
"enumeration",
"as",
"an",
"array",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/QtiShape.php#L92-L101 |
oat-sa/qti-sdk | src/qtism/common/datatypes/QtiShape.php | QtiShape.getConstantByName | public static function getConstantByName($name)
{
switch (strtolower($name)) {
case 'default':
return self::DEF;
break;
case 'rect':
return self::RECT;
break;
case 'circle':
return self::CIRCLE;
... | php | public static function getConstantByName($name)
{
switch (strtolower($name)) {
case 'default':
return self::DEF;
break;
case 'rect':
return self::RECT;
break;
case 'circle':
return self::CIRCLE;
... | [
"public",
"static",
"function",
"getConstantByName",
"(",
"$",
"name",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"name",
")",
")",
"{",
"case",
"'default'",
":",
"return",
"self",
"::",
"DEF",
";",
"break",
";",
"case",
"'rect'",
":",
"return",
... | Get the constant value associated with $name.
@param string $name
@return integer|boolean The constant value associated with the name or false if not found. | [
"Get",
"the",
"constant",
"value",
"associated",
"with",
"$name",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/QtiShape.php#L109-L136 |
oat-sa/qti-sdk | src/qtism/common/datatypes/QtiShape.php | QtiShape.getNameByConstant | public static function getNameByConstant($constant)
{
switch ($constant) {
case self::DEF:
return 'default';
break;
case self::RECT:
return 'rect';
break;
case self::CIRCLE:
return 'circle';
... | php | public static function getNameByConstant($constant)
{
switch ($constant) {
case self::DEF:
return 'default';
break;
case self::RECT:
return 'rect';
break;
case self::CIRCLE:
return 'circle';
... | [
"public",
"static",
"function",
"getNameByConstant",
"(",
"$",
"constant",
")",
"{",
"switch",
"(",
"$",
"constant",
")",
"{",
"case",
"self",
"::",
"DEF",
":",
"return",
"'default'",
";",
"break",
";",
"case",
"self",
"::",
"RECT",
":",
"return",
"'rect... | Get the name associated with $constant.
@param integer $constant
@return string|boolean The name or false if not found. | [
"Get",
"the",
"name",
"associated",
"with",
"$constant",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/QtiShape.php#L144-L171 |
oat-sa/qti-sdk | src/qtism/data/state/Weight.php | Weight.setValue | public function setValue($value)
{
if (is_int($value) || is_float($value)) {
$this->value = $value;
} else {
$msg = "The value of a Weight must be a valid integer or float value, '" . gettype($value) . "' given.";
throw new InvalidArgumentException($msg);
... | php | public function setValue($value)
{
if (is_int($value) || is_float($value)) {
$this->value = $value;
} else {
$msg = "The value of a Weight must be a valid integer or float value, '" . gettype($value) . "' given.";
throw new InvalidArgumentException($msg);
... | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"value",
")",
"||",
"is_float",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"$",
"value",
";",
"}",
"else",
"{",
"$",
"msg",
"=... | Set the value of the Weight.
@param int|float $value A in integer/float value.
@throws \InvalidArgumentException If $value is not an integer nor a float. | [
"Set",
"the",
"value",
"of",
"the",
"Weight",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/Weight.php#L123-L131 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/MapResponseProcessor.php | MapResponseProcessor.process | public function process()
{
$expr = $this->getExpression();
$state = $this->getState();
$identifier = $expr->getIdentifier();
$variable = $state->getVariable($identifier);
if (!is_null($variable)) {
if ($variable instanceof ResponseVariable) {
$... | php | public function process()
{
$expr = $this->getExpression();
$state = $this->getState();
$identifier = $expr->getIdentifier();
$variable = $state->getVariable($identifier);
if (!is_null($variable)) {
if ($variable instanceof ResponseVariable) {
$... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"expr",
"=",
"$",
"this",
"->",
"getExpression",
"(",
")",
";",
"$",
"state",
"=",
"$",
"this",
"->",
"getState",
"(",
")",
";",
"$",
"identifier",
"=",
"$",
"expr",
"->",
"getIdentifier",
"(",
"... | Process the MapResponse expression.
* An ExpressionProcessingException is thrown if the variable is not defined.
* An ExpressionProcessingException is thrown if the variable has no mapping defined.
* An ExpressionProcessingException is thrown if the variable is not a ResponseVariable.
* An ExpressionProcessingExceptio... | [
"Process",
"the",
"MapResponse",
"expression",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/MapResponseProcessor.php#L69-L179 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/qtipl/rules/TemplateConditionQtiPLRenderer.php | TemplateConditionQtiPLRenderer.render | public function render($something)
{
$renderer = new QtiPLRenderer($this->getCRO());
$qtipl = $renderer->render($something->getTemplateIf());
foreach ($something->getTemplateElseIfs() as $elseif) {
$qtipl .= " " . $renderer->render($elseif);
}
$qtipl .= ($someth... | php | public function render($something)
{
$renderer = new QtiPLRenderer($this->getCRO());
$qtipl = $renderer->render($something->getTemplateIf());
foreach ($something->getTemplateElseIfs() as $elseif) {
$qtipl .= " " . $renderer->render($elseif);
}
$qtipl .= ($someth... | [
"public",
"function",
"render",
"(",
"$",
"something",
")",
"{",
"$",
"renderer",
"=",
"new",
"QtiPLRenderer",
"(",
"$",
"this",
"->",
"getCRO",
"(",
")",
")",
";",
"$",
"qtipl",
"=",
"$",
"renderer",
"->",
"render",
"(",
"$",
"something",
"->",
"get... | 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/TemplateConditionQtiPLRenderer.php#L45-L56 |
oat-sa/qti-sdk | src/qtism/common/datatypes/QtiIdentifier.php | QtiIdentifier.checkType | protected function checkType($value)
{
if (is_string($value) !== true) {
$msg = "The Identifier Datatype only accepts to store identifier values.";
throw new InvalidArgumentException($msg);
} elseif ($value === '') {
$msg = "The Identifier Datatype do not accept e... | php | protected function checkType($value)
{
if (is_string($value) !== true) {
$msg = "The Identifier Datatype only accepts to store identifier values.";
throw new InvalidArgumentException($msg);
} elseif ($value === '') {
$msg = "The Identifier Datatype do not accept e... | [
"protected",
"function",
"checkType",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"!==",
"true",
")",
"{",
"$",
"msg",
"=",
"\"The Identifier Datatype only accepts to store identifier values.\"",
";",
"throw",
"new",
"InvalidArgume... | Checks whether or not $value is a string value.
@throws \InvalidArgumentException If $value is not a string value. | [
"Checks",
"whether",
"or",
"not",
"$value",
"is",
"a",
"string",
"value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/datatypes/QtiIdentifier.php#L42-L51 |
oat-sa/qti-sdk | src/qtism/data/expressions/operators/StringMatch.php | StringMatch.setSubstring | public function setSubstring($substring)
{
if (is_bool($substring)) {
$this->substring = $substring;
} else {
$msg = "The substring argument must be a boolean, '" . gettype($substring) . "' given.";
throw new InvalidArgumentException($msg);
}
} | php | public function setSubstring($substring)
{
if (is_bool($substring)) {
$this->substring = $substring;
} else {
$msg = "The substring argument must be a boolean, '" . gettype($substring) . "' given.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setSubstring",
"(",
"$",
"substring",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"substring",
")",
")",
"{",
"$",
"this",
"->",
"substring",
"=",
"$",
"substring",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The substring argument mu... | Set the substring attribute.
@param boolean $substring A boolean value.
@throws \InvalidArgumentException If $substring is not a boolean.
@deprecated | [
"Set",
"the",
"substring",
"attribute",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/expressions/operators/StringMatch.php#L113-L121 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/RandomIntegerMarshaller.php | RandomIntegerMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'min', $component->getMin());
$this->setDOMElementAttribute($element, 'max', $component->getMax());
if ($c... | php | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'min', $component->getMin());
$this->setDOMElementAttribute($element, 'max', $component->getMax());
if ($c... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"static",
"::",
"getDOMCradle",
"(",
")",
"->",
"createElement",
"(",
"$",
"component",
"->",
"getQtiClassName",
"(",
")",
")",
";",
"$",
"this",
"->... | Marshall a RandomInteger object into a DOMElement object.
@param \qtism\data\QtiComponent $component A RandomInteger object.
@return \DOMElement The according DOMElement object. | [
"Marshall",
"a",
"RandomInteger",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/RandomIntegerMarshaller.php#L44-L56 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/RandomIntegerMarshaller.php | RandomIntegerMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
if (($max = $this->getDOMElementAttributeAs($element, 'max', 'string')) !== null) {
$max = (Format::isVariableRef($max)) ? $max : intval($max);
$object = new RandomInteger(0, $max);
if (($step = $this->getDOMElementAtt... | php | protected function unmarshall(DOMElement $element)
{
if (($max = $this->getDOMElementAttributeAs($element, 'max', 'string')) !== null) {
$max = (Format::isVariableRef($max)) ? $max : intval($max);
$object = new RandomInteger(0, $max);
if (($step = $this->getDOMElementAtt... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"if",
"(",
"(",
"$",
"max",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'max'",
",",
"'string'",
")",
")",
"!==",
"null",
")",
"{",
"... | Unmarshall a DOMElement object corresponding to a QTI randomInteger element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A RandomInteger object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException If the mandatory attributes 'min' or 'max' are missing from $element. | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"randomInteger",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/RandomIntegerMarshaller.php#L65-L85 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/OutcomeDeclarationMarshaller.php | OutcomeDeclarationMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = parent::marshall($component);
$version = $this->getVersion();
// deal with views.
// !!! If $arrayViews contain all possible views, it means that the treated
// !!! outcome is relevant to all views, as per QTI... | php | protected function marshall(QtiComponent $component)
{
$element = parent::marshall($component);
$version = $this->getVersion();
// deal with views.
// !!! If $arrayViews contain all possible views, it means that the treated
// !!! outcome is relevant to all views, as per QTI... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"parent",
"::",
"marshall",
"(",
"$",
"component",
")",
";",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"// deal with views... | Marshall an OutcomeDeclaration object into a DOMElement object.
@param \qtism\data\QtiComponent $component An OutcomeDeclaration object.
@return \DOMElement The according DOMElement object. | [
"Marshall",
"an",
"OutcomeDeclaration",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/OutcomeDeclarationMarshaller.php#L47-L98 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/OutcomeDeclarationMarshaller.php | OutcomeDeclarationMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
try {
$version = $this->getVersion();
$baseComponent = parent::unmarshall($element);
$object = new OutcomeDeclaration($baseComponent->getIdentifier());
$object->setBaseType($baseComponent->getBaseType());
... | php | protected function unmarshall(DOMElement $element)
{
try {
$version = $this->getVersion();
$baseComponent = parent::unmarshall($element);
$object = new OutcomeDeclaration($baseComponent->getIdentifier());
$object->setBaseType($baseComponent->getBaseType());
... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"try",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"$",
"baseComponent",
"=",
"parent",
"::",
"unmarshall",
"(",
"$",
"element",
")",
";",
... | Unmarshall a DOMElement object corresponding to a QTI outcomeDeclaration element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent An OutcomeDeclaration object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"outcomeDeclaration",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/OutcomeDeclarationMarshaller.php#L107-L176 |
oat-sa/qti-sdk | src/qtism/data/state/Utils.php | Utils.createShufflingFromInteraction | static public function createShufflingFromInteraction(Interaction $interaction)
{
$className = $interaction->getQtiClassName();
$groups = array();
$shufflableInteractions = array(
'choiceInteraction',
'orderInteraction',
'associateInteraction',
... | php | static public function createShufflingFromInteraction(Interaction $interaction)
{
$className = $interaction->getQtiClassName();
$groups = array();
$shufflableInteractions = array(
'choiceInteraction',
'orderInteraction',
'associateInteraction',
... | [
"static",
"public",
"function",
"createShufflingFromInteraction",
"(",
"Interaction",
"$",
"interaction",
")",
"{",
"$",
"className",
"=",
"$",
"interaction",
"->",
"getQtiClassName",
"(",
")",
";",
"$",
"groups",
"=",
"array",
"(",
")",
";",
"$",
"shufflableI... | Create a Shuffling component from a given Interaction object.
A Shuffling object will be created depending on the $interaction object given.
If $interaction is an interaction type subject to shuffling e.g. choiceInteraction,
orderInteraction, associateInteraction, matchInteraction, gapMatchInteraction,
inlineChoiceInt... | [
"Create",
"a",
"Shuffling",
"component",
"from",
"a",
"given",
"Interaction",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/Utils.php#L50-L129 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/AnyNMarshaller.php | AnyNMarshaller.unmarshallChildrenKnown | protected function unmarshallChildrenKnown(DOMElement $element, QtiComponentCollection $children)
{
if (($min = $this->getDOMElementAttributeAs($element, 'min')) !== null) {
if (Format::isInteger($min)) {
$min = intval($min);
}
if (($max = $this->getDOME... | php | protected function unmarshallChildrenKnown(DOMElement $element, QtiComponentCollection $children)
{
if (($min = $this->getDOMElementAttributeAs($element, 'min')) !== null) {
if (Format::isInteger($min)) {
$min = intval($min);
}
if (($max = $this->getDOME... | [
"protected",
"function",
"unmarshallChildrenKnown",
"(",
"DOMElement",
"$",
"element",
",",
"QtiComponentCollection",
"$",
"children",
")",
"{",
"if",
"(",
"(",
"$",
"min",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'min'",
... | Unmarshall a QTI anyN operator element into an AnyN object.
@param \DOMElement $element The anyN element to unmarshall.
@param \qtism\data\QtiComponentCollection $children A collection containing the child Expression objects composing the Operator.
@return \qtism\data\QtiComponent An AnyN object.
@throws \qtism\data\s... | [
"Unmarshall",
"a",
"QTI",
"anyN",
"operator",
"element",
"into",
"an",
"AnyN",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/AnyNMarshaller.php#L68-L93 |
oat-sa/qti-sdk | src/qtism/data/expressions/operators/StatsOperator.php | StatsOperator.setName | public function setName($name)
{
if (in_array($name, Statistics::asArray())) {
$this->name = $name;
} else {
$msg = "The name argument must be a value from the Statistics enumeration, '" . $name . "' given.";
throw new InvalidArgumentException($msg);
}
... | php | public function setName($name)
{
if (in_array($name, Statistics::asArray())) {
$this->name = $name;
} else {
$msg = "The name argument must be a value from the Statistics enumeration, '" . $name . "' given.";
throw new InvalidArgumentException($msg);
}
... | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"Statistics",
"::",
"asArray",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"}",
"else",
"{",
"$",
"msg",
"... | Set the statistics operator to use.
@param integer $name A value from the Statistics enumeration.
@throws \InvalidArgumentException If $name is not a value from the Statistics enumeration. | [
"Set",
"the",
"statistics",
"operator",
"to",
"use",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/expressions/operators/StatsOperator.php#L71-L79 |
oat-sa/qti-sdk | src/qtism/data/state/Shuffling.php | Shuffling.setShufflingGroups | public function setShufflingGroups(ShufflingGroupCollection $shufflingGroups)
{
if (count($shufflingGroups) === 0) {
$msg = "A Shuffling object must be composed of at least 1 ShufflingGroup object. None given";
throw new InvalidArgumentException($msg);
} elseif (($c = count(... | php | public function setShufflingGroups(ShufflingGroupCollection $shufflingGroups)
{
if (count($shufflingGroups) === 0) {
$msg = "A Shuffling object must be composed of at least 1 ShufflingGroup object. None given";
throw new InvalidArgumentException($msg);
} elseif (($c = count(... | [
"public",
"function",
"setShufflingGroups",
"(",
"ShufflingGroupCollection",
"$",
"shufflingGroups",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"shufflingGroups",
")",
"===",
"0",
")",
"{",
"$",
"msg",
"=",
"\"A Shuffling object must be composed of at least 1 ShufflingGrou... | Set the ShufflingGroups.
@param \qtism\data\state\ShufflingGroupCollection $shufflingGroups
@throws \InvalidArgumentException If $shufflingGroups does not contain 1 to 2 ShufflingGroup objects. | [
"Set",
"the",
"ShufflingGroups",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/Shuffling.php#L99-L110 |
oat-sa/qti-sdk | src/qtism/data/state/Shuffling.php | Shuffling.shuffle | public function shuffle()
{
$shuffling = clone $this;
$groups = $shuffling->getShufflingGroups();
for ($i = 0; $i < count($groups); $i++) {
$identifiers = $groups[$i]->getIdentifiers();
$fixedIdentifiers = $groups[$i]->getFixedIdentifiers()->getArrayCopy();
... | php | public function shuffle()
{
$shuffling = clone $this;
$groups = $shuffling->getShufflingGroups();
for ($i = 0; $i < count($groups); $i++) {
$identifiers = $groups[$i]->getIdentifiers();
$fixedIdentifiers = $groups[$i]->getFixedIdentifiers()->getArrayCopy();
... | [
"public",
"function",
"shuffle",
"(",
")",
"{",
"$",
"shuffling",
"=",
"clone",
"$",
"this",
";",
"$",
"groups",
"=",
"$",
"shuffling",
"->",
"getShufflingGroups",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"... | Shuffles the identifiers of the ShufflingGroups.
Calling this method will create a new deep copy of this Shuffling object, with identifiers of the Shuffling
Groups shuffled again.
@return \qtism\data\state\Shuffling | [
"Shuffles",
"the",
"identifiers",
"of",
"the",
"ShufflingGroups",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/Shuffling.php#L130-L161 |
oat-sa/qti-sdk | src/qtism/data/state/Shuffling.php | Shuffling.getIdentifierAt | public function getIdentifierAt($index) {
$i = 0;
foreach ($this->getShufflingGroups() as $shufflingGroup) {
foreach ($shufflingGroup->getIdentifiers() as $identifier) {
if ($i === $index) {
return $identifier;
}
$i... | php | public function getIdentifierAt($index) {
$i = 0;
foreach ($this->getShufflingGroups() as $shufflingGroup) {
foreach ($shufflingGroup->getIdentifiers() as $identifier) {
if ($i === $index) {
return $identifier;
}
$i... | [
"public",
"function",
"getIdentifierAt",
"(",
"$",
"index",
")",
"{",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"getShufflingGroups",
"(",
")",
"as",
"$",
"shufflingGroup",
")",
"{",
"foreach",
"(",
"$",
"shufflingGroup",
"->",
"getIden... | Retrieve an identifier by $index.
You can reach identifiers in all the ShufflingGroup objects composing the Shuffling object.
For instance, if the Shuffling object is composed of 2 ShufflingGroup objects containing
respectively ['id1', 'id2', 'id3'] and ['id4', 'id5', 'id6'], then 'id2' is at index 1 and
'id5' is at i... | [
"Retrieve",
"an",
"identifier",
"by",
"$index",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/state/Shuffling.php#L175-L188 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/ResponseProcessingMarshaller.php | ResponseProcessingMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = self::getDOMCradle()->createElement($component->getQtiClassName());
if ($component->hasTemplate() === true) {
$this->setDOMElementAttribute($element, 'template', $component->getTemplate());
}
if ($compone... | php | protected function marshall(QtiComponent $component)
{
$element = self::getDOMCradle()->createElement($component->getQtiClassName());
if ($component->hasTemplate() === true) {
$this->setDOMElementAttribute($element, 'template', $component->getTemplate());
}
if ($compone... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"self",
"::",
"getDOMCradle",
"(",
")",
"->",
"createElement",
"(",
"$",
"component",
"->",
"getQtiClassName",
"(",
")",
")",
";",
"if",
"(",
"$",
... | Marshall a ResponseProcessing object into a DOMElement object.
@param \qtism\data\QtiComponent $component A ResponseProcessing object.
@return \DOMElement The according DOMElement object.
@throws \qtism\data\storage\xml\marshalling\MarshallingException | [
"Marshall",
"a",
"ResponseProcessing",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/ResponseProcessingMarshaller.php#L45-L63 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/ResponseProcessingMarshaller.php | ResponseProcessingMarshaller.unmarshall | protected function unmarshall(DOMElement $element, ResponseProcessing $responseProcessing = null)
{
$responseRuleElts = self::getChildElements($element);
$responseRules = new ResponseRuleCollection();
for ($i = 0; $i < count($responseRuleElts); $i++) {
$marshaller = $this->getMa... | php | protected function unmarshall(DOMElement $element, ResponseProcessing $responseProcessing = null)
{
$responseRuleElts = self::getChildElements($element);
$responseRules = new ResponseRuleCollection();
for ($i = 0; $i < count($responseRuleElts); $i++) {
$marshaller = $this->getMa... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
",",
"ResponseProcessing",
"$",
"responseProcessing",
"=",
"null",
")",
"{",
"$",
"responseRuleElts",
"=",
"self",
"::",
"getChildElements",
"(",
"$",
"element",
")",
";",
"$",
"responseRu... | Unmarshall a DOMElement object corresponding to a QTI responseProcessing element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A ResponseProcessing object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"responseProcessing",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/ResponseProcessingMarshaller.php#L72-L98 |
oat-sa/qti-sdk | src/qtism/data/content/TemplateInline.php | TemplateInline.setXmlBase | public function setXmlBase($xmlBase = '')
{
if (is_string($xmlBase) && (empty($xmlBase) || Format::isUri($xmlBase))) {
$this->xmlBase = $xmlBase;
} else {
$msg = "The 'base' argument must be an empty string or a valid URI, '" . $xmlBase . "' given";
throw new Inva... | php | public function setXmlBase($xmlBase = '')
{
if (is_string($xmlBase) && (empty($xmlBase) || Format::isUri($xmlBase))) {
$this->xmlBase = $xmlBase;
} else {
$msg = "The 'base' argument must be an empty string or a valid URI, '" . $xmlBase . "' given";
throw new Inva... | [
"public",
"function",
"setXmlBase",
"(",
"$",
"xmlBase",
"=",
"''",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"xmlBase",
")",
"&&",
"(",
"empty",
"(",
"$",
"xmlBase",
")",
"||",
"Format",
"::",
"isUri",
"(",
"$",
"xmlBase",
")",
")",
")",
"{",
... | Set the base URI of the TemplateBlock.
@param string $xmlBase A URI.
@throws \InvalidArgumentException if $base is not a valid URI nor an empty string. | [
"Set",
"the",
"base",
"URI",
"of",
"the",
"TemplateBlock",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/TemplateInline.php#L96-L104 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.isBaseTypeCompliant | static public function isBaseTypeCompliant($baseType, $value)
{
if ($value === null) {
return true; // A value can always be null.
} elseif ($value instanceof QtiDatatype && $baseType === $value->getBaseType()) {
return true;
} else {
return false;
... | php | static public function isBaseTypeCompliant($baseType, $value)
{
if ($value === null) {
return true; // A value can always be null.
} elseif ($value instanceof QtiDatatype && $baseType === $value->getBaseType()) {
return true;
} else {
return false;
... | [
"static",
"public",
"function",
"isBaseTypeCompliant",
"(",
"$",
"baseType",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"true",
";",
"// A value can always be null.",
"}",
"elseif",
"(",
"$",
"value",
"instanceof... | Whether a given $value is compliant with a given $baseType.
@param int $baseType A value from the BaseType enumeration.
@param mixed $value A value.
@return boolean | [
"Whether",
"a",
"given",
"$value",
"is",
"compliant",
"with",
"a",
"given",
"$baseType",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L78-L87 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.isCardinalityCompliant | static public function isCardinalityCompliant($cardinality, $value)
{
if ($value === null) {
return true;
} elseif ($value instanceof QtiDatatype && $cardinality === $value->getCardinality()) {
return true;
} else {
return false;
}
} | php | static public function isCardinalityCompliant($cardinality, $value)
{
if ($value === null) {
return true;
} elseif ($value instanceof QtiDatatype && $cardinality === $value->getCardinality()) {
return true;
} else {
return false;
}
} | [
"static",
"public",
"function",
"isCardinalityCompliant",
"(",
"$",
"cardinality",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"elseif",
"(",
"$",
"value",
"instanceof",
"QtiDatatype",
"&&",
... | Whether a given $cardinality is compliant with a given $value.
@param integer $cardinality
@param mixed $value
@return boolean | [
"Whether",
"a",
"given",
"$cardinality",
"is",
"compliant",
"with",
"a",
"given",
"$value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L96-L105 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.throwTypingError | static public function throwTypingError($value)
{
$givenValue = (gettype($value) == 'object') ? get_class($value) : gettype($value);
$acceptedTypes = array('boolean', 'integer', 'float', 'double', 'string', 'Duration', 'Pair', 'DirectedPair', 'Point');
$acceptedTypes = implode(", ", $accepte... | php | static public function throwTypingError($value)
{
$givenValue = (gettype($value) == 'object') ? get_class($value) : gettype($value);
$acceptedTypes = array('boolean', 'integer', 'float', 'double', 'string', 'Duration', 'Pair', 'DirectedPair', 'Point');
$acceptedTypes = implode(", ", $accepte... | [
"static",
"public",
"function",
"throwTypingError",
"(",
"$",
"value",
")",
"{",
"$",
"givenValue",
"=",
"(",
"gettype",
"(",
"$",
"value",
")",
"==",
"'object'",
")",
"?",
"get_class",
"(",
"$",
"value",
")",
":",
"gettype",
"(",
"$",
"value",
")",
... | Throw an InvalidArgumentException depending on a PHP in-memory value.
@param mixed $value A given PHP primitive value.
@throws \InvalidArgumentException In any case. | [
"Throw",
"an",
"InvalidArgumentException",
"depending",
"on",
"a",
"PHP",
"in",
"-",
"memory",
"value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L113-L120 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.throwBaseTypeTypingError | static public function throwBaseTypeTypingError($baseType, $value)
{
$givenValue = (gettype($value) == 'object') ? get_class($value) : gettype($value) . ':' . $value;
$acceptedTypes = BaseType::getNameByConstant($baseType);
$msg = "The value '${givenValue}' is not compliant with the '${accep... | php | static public function throwBaseTypeTypingError($baseType, $value)
{
$givenValue = (gettype($value) == 'object') ? get_class($value) : gettype($value) . ':' . $value;
$acceptedTypes = BaseType::getNameByConstant($baseType);
$msg = "The value '${givenValue}' is not compliant with the '${accep... | [
"static",
"public",
"function",
"throwBaseTypeTypingError",
"(",
"$",
"baseType",
",",
"$",
"value",
")",
"{",
"$",
"givenValue",
"=",
"(",
"gettype",
"(",
"$",
"value",
")",
"==",
"'object'",
")",
"?",
"get_class",
"(",
"$",
"value",
")",
":",
"gettype"... | Throw an InvalidArgumentException depending on a given qti:baseType
and an in-memory PHP value.
@param int $baseType A value from the BaseType enumeration.
@param mixed $value A given PHP primitive value.
@throws \InvalidArgumentException In any case. | [
"Throw",
"an",
"InvalidArgumentException",
"depending",
"on",
"a",
"given",
"qti",
":",
"baseType",
"and",
"an",
"in",
"-",
"memory",
"PHP",
"value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L130-L136 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.inferBaseType | static public function inferBaseType($value)
{
if ($value === null) {
return false;
} elseif ($value instanceof RecordContainer) {
return false;
} elseif ($value instanceof QtiDatatype) {
return $value->getBaseType();
} else {
return fa... | php | static public function inferBaseType($value)
{
if ($value === null) {
return false;
} elseif ($value instanceof RecordContainer) {
return false;
} elseif ($value instanceof QtiDatatype) {
return $value->getBaseType();
} else {
return fa... | [
"static",
"public",
"function",
"inferBaseType",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"elseif",
"(",
"$",
"value",
"instanceof",
"RecordContainer",
")",
"{",
"return",
"false",
";",
... | Infer the QTI baseType of a given $value.
@param mixed $value A value you want to know the QTI baseType.
@return integer|false A value from the BaseType enumeration or false if the baseType could not be infered. | [
"Infer",
"the",
"QTI",
"baseType",
"of",
"a",
"given",
"$value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L144-L155 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.inferCardinality | static public function inferCardinality($value)
{
if ($value === null) {
return false;
} elseif ($value instanceof QtiDatatype) {
return $value->getCardinality();
} else {
return false;
}
} | php | static public function inferCardinality($value)
{
if ($value === null) {
return false;
} elseif ($value instanceof QtiDatatype) {
return $value->getCardinality();
} else {
return false;
}
} | [
"static",
"public",
"function",
"inferCardinality",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"elseif",
"(",
"$",
"value",
"instanceof",
"QtiDatatype",
")",
"{",
"return",
"$",
"value",
... | Infer the cardinality of a given $value.
Please note that:
* A RecordContainer has no cardinality, thus it always returns false for such a container.
* The null value has no cardinality, this it always returns false for such a value.
@param mixed $value A value you want to infer the cardinality.
@return integer|bool... | [
"Infer",
"the",
"cardinality",
"of",
"a",
"given",
"$value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L168-L177 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.isValidVariableIdentifier | static public function isValidVariableIdentifier($string)
{
if (gettype($string) !== 'string' || empty($string)) {
return false;
}
$pattern = '/^[a-z][a-z0-9_\-]*(?:(?:\.[1-9][0-9]*){0,1}(?:\.[a-z][a-z0-9_\-]*){0,1}){0,1}$/iu';
return preg_match($pattern, $string) === 1... | php | static public function isValidVariableIdentifier($string)
{
if (gettype($string) !== 'string' || empty($string)) {
return false;
}
$pattern = '/^[a-z][a-z0-9_\-]*(?:(?:\.[1-9][0-9]*){0,1}(?:\.[a-z][a-z0-9_\-]*){0,1}){0,1}$/iu';
return preg_match($pattern, $string) === 1... | [
"static",
"public",
"function",
"isValidVariableIdentifier",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"gettype",
"(",
"$",
"string",
")",
"!==",
"'string'",
"||",
"empty",
"(",
"$",
"string",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"pattern",
... | Whether a given $string is a valid variable identifier.
Q01 -> Valid
Q_01 -> Valid
1_Q01 -> Invalid
Q01.SCORE -> Valid
Q-01.1.Score -> Valid
Q*01.2.Score -> Invalid
@param string $string A string value.
@return boolean Whether the given $string is a valid variable identifier. | [
"Whether",
"a",
"given",
"$string",
"is",
"a",
"valid",
"variable",
"identifier",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L192-L201 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.floatArrayToInteger | static public function floatArrayToInteger($floatArray)
{
$integerArray = array();
foreach ($floatArray as $f) {
$integerArray[] = (is_null($f) === false) ? intval($f) : null;
}
return $integerArray;
} | php | static public function floatArrayToInteger($floatArray)
{
$integerArray = array();
foreach ($floatArray as $f) {
$integerArray[] = (is_null($f) === false) ? intval($f) : null;
}
return $integerArray;
} | [
"static",
"public",
"function",
"floatArrayToInteger",
"(",
"$",
"floatArray",
")",
"{",
"$",
"integerArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"floatArray",
"as",
"$",
"f",
")",
"{",
"$",
"integerArray",
"[",
"]",
"=",
"(",
"is_null",
... | Transforms the content of float array to an integer array.
@param array $floatArray An array containing float values.
@return array An array containing integer values. | [
"Transforms",
"the",
"content",
"of",
"float",
"array",
"to",
"an",
"integer",
"array",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L209-L217 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.integerArrayToFloat | static public function integerArrayToFloat($integerArray)
{
$floatArray = array();
foreach ($integerArray as $i) {
$floatArray[] = (is_null($i) === false) ? floatval($i) : null;
}
return $floatArray;
} | php | static public function integerArrayToFloat($integerArray)
{
$floatArray = array();
foreach ($integerArray as $i) {
$floatArray[] = (is_null($i) === false) ? floatval($i) : null;
}
return $floatArray;
} | [
"static",
"public",
"function",
"integerArrayToFloat",
"(",
"$",
"integerArray",
")",
"{",
"$",
"floatArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"integerArray",
"as",
"$",
"i",
")",
"{",
"$",
"floatArray",
"[",
"]",
"=",
"(",
"is_null",
... | Transforms the content of an integer array to a float array.
@param array $integerArray An array containing integer values.
@return array An array containing float values. | [
"Transforms",
"the",
"content",
"of",
"an",
"integer",
"array",
"to",
"a",
"float",
"array",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L225-L233 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.valueToRuntime | static public function valueToRuntime($v, $baseType)
{
if ($v !== null) {
if (is_int($v) === true) {
if ($baseType === -1 || $baseType === BaseType::INTEGER) {
return new QtiInteger($v);
} elseif ($baseType === BaseType::INT_OR_IDENTIFIER) {
... | php | static public function valueToRuntime($v, $baseType)
{
if ($v !== null) {
if (is_int($v) === true) {
if ($baseType === -1 || $baseType === BaseType::INTEGER) {
return new QtiInteger($v);
} elseif ($baseType === BaseType::INT_OR_IDENTIFIER) {
... | [
"static",
"public",
"function",
"valueToRuntime",
"(",
"$",
"v",
",",
"$",
"baseType",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"v",
")",
"===",
"true",
")",
"{",
"if",
"(",
"$",
"baseType",
"===",
... | Transform a given PHP scalar value to a QtiScalar equivalent object.
@param mixed|null $v
@param integer $baseType A value from the BaseType enumeration.
@return \qtism\common\datatypes\QtiScalar | [
"Transform",
"a",
"given",
"PHP",
"scalar",
"value",
"to",
"a",
"QtiScalar",
"equivalent",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L242-L274 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.isNull | static public function isNull(QtiDatatype $value = null)
{
return is_null($value) === true || ($value instanceof QtiString && $value->getValue() === '') || ($value instanceof Container && count($value) === 0);
} | php | static public function isNull(QtiDatatype $value = null)
{
return is_null($value) === true || ($value instanceof QtiString && $value->getValue() === '') || ($value instanceof Container && count($value) === 0);
} | [
"static",
"public",
"function",
"isNull",
"(",
"QtiDatatype",
"$",
"value",
"=",
"null",
")",
"{",
"return",
"is_null",
"(",
"$",
"value",
")",
"===",
"true",
"||",
"(",
"$",
"value",
"instanceof",
"QtiString",
"&&",
"$",
"value",
"->",
"getValue",
"(",
... | Whether or not a QtiDatatype is considered to be null.
As per the QTI specification, the NULL value, empty strings and empty containers
are always treated as NULL values.
@param \qtism\common\datatypes\QtiDatatype $value
@return boolean | [
"Whether",
"or",
"not",
"a",
"QtiDatatype",
"is",
"considered",
"to",
"be",
"null",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L285-L288 |
oat-sa/qti-sdk | src/qtism/runtime/common/Utils.php | Utils.equals | static public function equals(QtiDatatype $a = null, QtiDatatype $b = null)
{
return (is_null($a) ? is_null($b) : $a->equals($b));
} | php | static public function equals(QtiDatatype $a = null, QtiDatatype $b = null)
{
return (is_null($a) ? is_null($b) : $a->equals($b));
} | [
"static",
"public",
"function",
"equals",
"(",
"QtiDatatype",
"$",
"a",
"=",
"null",
",",
"QtiDatatype",
"$",
"b",
"=",
"null",
")",
"{",
"return",
"(",
"is_null",
"(",
"$",
"a",
")",
"?",
"is_null",
"(",
"$",
"b",
")",
":",
"$",
"a",
"->",
"equa... | Whether or not two QtiDatatype instances are equals.
Because the runtime model
also deals with null values, this utility method helps to determine equality
easily, without testing specifically if one or both values are null prior
to perform QtiDatatype::equals().
@param QtiDatatype $a
@param QtiDatatype $b
@return bo... | [
"Whether",
"or",
"not",
"two",
"QtiDatatype",
"instances",
"are",
"equals",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/Utils.php#L302-L305 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/PrintedVariableMarshaller.php | PrintedVariableMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = $this->createElement($component);
$version = $this->getVersion();
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
$this->setDOMElementAttribute($element, 'base', $component-... | php | protected function marshall(QtiComponent $component)
{
$element = $this->createElement($component);
$version = $this->getVersion();
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
$this->setDOMElementAttribute($element, 'base', $component-... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"$",
"this",
"->",
"createElement",
"(",
"$",
"component",
")",
";",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"$",
"t... | Marshall a PrintedVariable object into a DOMElement object.
@param \qtism\data\QtiComponent $component A PrintedVariable object.
@return \DOMElement The according DOMElement object.
@throws \qtism\data\storage\xml\marshalling\MarshallingException | [
"Marshall",
"a",
"PrintedVariable",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/PrintedVariableMarshaller.php#L47-L80 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/PrintedVariableMarshaller.php | PrintedVariableMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
$version = $this->getVersion();
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
$component = new PrintedVariable($identifier);
if (($format = $this->getDOMElementAttributeAs... | php | protected function unmarshall(DOMElement $element)
{
$version = $this->getVersion();
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
$component = new PrintedVariable($identifier);
if (($format = $this->getDOMElementAttributeAs... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"if",
"(",
"(",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"ele... | Unmarshall a DOMElement object corresponding to a printedVariable element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A PrintedVariable object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"printedVariable",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/PrintedVariableMarshaller.php#L89-L135 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/GapImg.php | GapImg.setObjectLabel | public function setObjectLabel($objectLabel)
{
if (is_string($objectLabel) === true) {
$this->objectLabel = $objectLabel;
} else {
$msg = "The 'objectLabel' argument must be a string, '" . gettype($objectLabel) . "' given.";
throw new InvalidArgumentException($msg... | php | public function setObjectLabel($objectLabel)
{
if (is_string($objectLabel) === true) {
$this->objectLabel = $objectLabel;
} else {
$msg = "The 'objectLabel' argument must be a string, '" . gettype($objectLabel) . "' given.";
throw new InvalidArgumentException($msg... | [
"public",
"function",
"setObjectLabel",
"(",
"$",
"objectLabel",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"objectLabel",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"objectLabel",
"=",
"$",
"objectLabel",
";",
"}",
"else",
"{",
"$",
"msg",
"=",... | Set an optional label for the image object to be inserted. An empty
string indicates the GapImg has no objectLabel.
@param string $objectLabel A label for the image.
@throws \InvalidArgumentException If $objectLabel is not a string value. | [
"Set",
"an",
"optional",
"label",
"for",
"the",
"image",
"object",
"to",
"be",
"inserted",
".",
"An",
"empty",
"string",
"indicates",
"the",
"GapImg",
"has",
"no",
"objectLabel",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/GapImg.php#L84-L92 |
oat-sa/qti-sdk | src/qtism/common/enums/Cardinality.php | Cardinality.getConstantByName | public static function getConstantByName($name)
{
switch (strtolower($name)) {
case 'single':
return self::SINGLE;
break;
case 'multiple':
return self::MULTIPLE;
break;
case 'ordered':
return self::... | php | public static function getConstantByName($name)
{
switch (strtolower($name)) {
case 'single':
return self::SINGLE;
break;
case 'multiple':
return self::MULTIPLE;
break;
case 'ordered':
return self::... | [
"public",
"static",
"function",
"getConstantByName",
"(",
"$",
"name",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"name",
")",
")",
"{",
"case",
"'single'",
":",
"return",
"self",
"::",
"SINGLE",
";",
"break",
";",
"case",
"'multiple'",
":",
"retur... | Get a constant value from its name.
@param unknown_type $name The name of the constant, as per QTI spec.
@return integer|boolean The constant value or false if not found. | [
"Get",
"a",
"constant",
"value",
"from",
"its",
"name",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/enums/Cardinality.php#L98-L121 |
oat-sa/qti-sdk | src/qtism/common/enums/Cardinality.php | Cardinality.getNameByConstant | public static function getNameByConstant($constant)
{
switch ($constant) {
case self::SINGLE:
return 'single';
break;
case self::MULTIPLE:
return 'multiple';
break;
case self::ORDERED:
return 'order... | php | public static function getNameByConstant($constant)
{
switch ($constant) {
case self::SINGLE:
return 'single';
break;
case self::MULTIPLE:
return 'multiple';
break;
case self::ORDERED:
return 'order... | [
"public",
"static",
"function",
"getNameByConstant",
"(",
"$",
"constant",
")",
"{",
"switch",
"(",
"$",
"constant",
")",
"{",
"case",
"self",
"::",
"SINGLE",
":",
"return",
"'single'",
";",
"break",
";",
"case",
"self",
"::",
"MULTIPLE",
":",
"return",
... | Get the name of a constant from its value.
@param string $constant The constant value to search the name for.
@return string|boolean The name of the constant or false if not found. | [
"Get",
"the",
"name",
"of",
"a",
"constant",
"from",
"its",
"value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/enums/Cardinality.php#L129-L152 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/MatchProcessor.php | MatchProcessor.process | public function process()
{
$operands = $this->getOperands();
$expression = $this->getExpression();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->sameCardinality() === false) {
$msg = "The Match Expression only accepts opera... | php | public function process()
{
$operands = $this->getOperands();
$expression = $this->getExpression();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->sameCardinality() === false) {
$msg = "The Match Expression only accepts opera... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"$",
"expression",
"=",
"$",
"this",
"->",
"getExpression",
"(",
")",
";",
"if",
"(",
"$",
"operands",
"->",
"containsNull",
"(",
"... | Process the Match Expression object.
@return boolean|null Whether the two expressions represent the same value or NULL if either of the sub-expressions is NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException | [
"Process",
"the",
"Match",
"Expression",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/MatchProcessor.php#L56-L84 |
oat-sa/qti-sdk | src/qtism/data/ExtendedAssessmentItemRef.php | ExtendedAssessmentItemRef.setTimeDependent | public function setTimeDependent($timeDependent)
{
if (gettype($timeDependent) === 'boolean') {
$this->timeDependent = $timeDependent;
} else {
$msg = "The timeDependent argument must be a boolean value, '" . gettype($timeDependent) . "' given.";
throw new Invalid... | php | public function setTimeDependent($timeDependent)
{
if (gettype($timeDependent) === 'boolean') {
$this->timeDependent = $timeDependent;
} else {
$msg = "The timeDependent argument must be a boolean value, '" . gettype($timeDependent) . "' given.";
throw new Invalid... | [
"public",
"function",
"setTimeDependent",
"(",
"$",
"timeDependent",
")",
"{",
"if",
"(",
"gettype",
"(",
"$",
"timeDependent",
")",
"===",
"'boolean'",
")",
"{",
"$",
"this",
"->",
"timeDependent",
"=",
"$",
"timeDependent",
";",
"}",
"else",
"{",
"$",
... | Set if the referenced Item is considered to be time dependent or not.
@param boolean $timeDependent Whether the referenced item is time dependent.
@throws \InvalidArgumentException If $timeDependent is not a boolean value. | [
"Set",
"if",
"the",
"referenced",
"Item",
"is",
"considered",
"to",
"be",
"time",
"dependent",
"or",
"not",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/ExtendedAssessmentItemRef.php#L452-L460 |
oat-sa/qti-sdk | src/qtism/data/ExtendedAssessmentItemRef.php | ExtendedAssessmentItemRef.createFromAssessmentItemRef | public static function createFromAssessmentItemRef(AssessmentItemRef $assessmentItemRef)
{
$identifier = $assessmentItemRef->getIdentifier();
$href = $assessmentItemRef->getHref();
$compactRef = new static($identifier, $href);
$compactRef->setBranchRules($assessmentItemRef->getBranch... | php | public static function createFromAssessmentItemRef(AssessmentItemRef $assessmentItemRef)
{
$identifier = $assessmentItemRef->getIdentifier();
$href = $assessmentItemRef->getHref();
$compactRef = new static($identifier, $href);
$compactRef->setBranchRules($assessmentItemRef->getBranch... | [
"public",
"static",
"function",
"createFromAssessmentItemRef",
"(",
"AssessmentItemRef",
"$",
"assessmentItemRef",
")",
"{",
"$",
"identifier",
"=",
"$",
"assessmentItemRef",
"->",
"getIdentifier",
"(",
")",
";",
"$",
"href",
"=",
"$",
"assessmentItemRef",
"->",
"... | Create a new ExtendedAssessmentItemRef object from an AssessmentItemRef object.
@param \qtism\data\AssessmentItemRef $assessmentItemRef An AssessmentItemRef object.
@return \qtism\data\ExtendedAssessmentItemRef An ExtendedAssessmentItemRef object. | [
"Create",
"a",
"new",
"ExtendedAssessmentItemRef",
"object",
"from",
"an",
"AssessmentItemRef",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/ExtendedAssessmentItemRef.php#L538-L554 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/MaxProcessor.php | MaxProcessor.process | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->anythingButRecord() === false) {
$msg = "The Max operator only accept values with a cardinality of single, multiple or order... | php | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull() === true) {
return null;
}
if ($operands->anythingButRecord() === false) {
$msg = "The Max operator only accept values with a cardinality of single, multiple or order... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"if",
"(",
"$",
"operands",
"->",
"containsNull",
"(",
")",
"===",
"true",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
... | Process the current expression.
@return float|integer|null The greatest of the operand values or NULL if any of the operand values is NULL.
@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/MaxProcessor.php#L59-L107 |
oat-sa/qti-sdk | src/qtism/runtime/common/TemplateVariable.php | TemplateVariable.setParamVariable | public function setParamVariable($paramVariable)
{
if (is_bool($paramVariable) === true) {
$this->paramVariable = $paramVariable;
} else {
$msg = "The 'paramVariable' argument must be a boolean value, '" . gettype($paramVariable) . "'.";
throw new InvalidArgumentE... | php | public function setParamVariable($paramVariable)
{
if (is_bool($paramVariable) === true) {
$this->paramVariable = $paramVariable;
} else {
$msg = "The 'paramVariable' argument must be a boolean value, '" . gettype($paramVariable) . "'.";
throw new InvalidArgumentE... | [
"public",
"function",
"setParamVariable",
"(",
"$",
"paramVariable",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"paramVariable",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"paramVariable",
"=",
"$",
"paramVariable",
";",
"}",
"else",
"{",
"$",
"msg"... | Set whether or not the template's value should be substituted for object
parameter values.
@param boolean $paramVariable
@throws \InvalidArgumentException | [
"Set",
"whether",
"or",
"not",
"the",
"template",
"s",
"value",
"should",
"be",
"substituted",
"for",
"object",
"parameter",
"values",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/TemplateVariable.php#L82-L90 |
oat-sa/qti-sdk | src/qtism/runtime/common/TemplateVariable.php | TemplateVariable.setMathVariable | public function setMathVariable($mathVariable)
{
if (is_bool($mathVariable) === true) {
$this->mathVariable = $mathVariable;
} else {
$msg = "The 'mathVariable' argument must be a boolean value, '" . gettype($mathVariable) . "'.";
throw new InvalidArgumentExceptio... | php | public function setMathVariable($mathVariable)
{
if (is_bool($mathVariable) === true) {
$this->mathVariable = $mathVariable;
} else {
$msg = "The 'mathVariable' argument must be a boolean value, '" . gettype($mathVariable) . "'.";
throw new InvalidArgumentExceptio... | [
"public",
"function",
"setMathVariable",
"(",
"$",
"mathVariable",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"mathVariable",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"mathVariable",
"=",
"$",
"mathVariable",
";",
"}",
"else",
"{",
"$",
"msg",
"... | Set whether or not the template variable's value should be substituted for identifiers that match
its name in MathML expressions.
@param boolean $mathVariable
@throws \InvalidArgumentException | [
"Set",
"whether",
"or",
"not",
"the",
"template",
"variable",
"s",
"value",
"should",
"be",
"substituted",
"for",
"identifiers",
"that",
"match",
"its",
"name",
"in",
"MathML",
"expressions",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/TemplateVariable.php#L110-L118 |
oat-sa/qti-sdk | src/qtism/runtime/common/TemplateVariable.php | TemplateVariable.createFromDataModel | public static function createFromDataModel(VariableDeclaration $variableDeclaration)
{
$variable = parent::createFromDataModel($variableDeclaration);
if ($variableDeclaration instanceof TemplateDeclaration) {
$variable->setParamVariable($variableDeclaration->isParamVariable());
... | php | public static function createFromDataModel(VariableDeclaration $variableDeclaration)
{
$variable = parent::createFromDataModel($variableDeclaration);
if ($variableDeclaration instanceof TemplateDeclaration) {
$variable->setParamVariable($variableDeclaration->isParamVariable());
... | [
"public",
"static",
"function",
"createFromDataModel",
"(",
"VariableDeclaration",
"$",
"variableDeclaration",
")",
"{",
"$",
"variable",
"=",
"parent",
"::",
"createFromDataModel",
"(",
"$",
"variableDeclaration",
")",
";",
"if",
"(",
"$",
"variableDeclaration",
"i... | Create a TemplateVariable object from its data model representation.
@param \qtism\data\state\VariableDeclaration $variableDeclaration
@throws \InvalidArgumentException
@return \qtism\runtime\common\TemplateVariable | [
"Create",
"a",
"TemplateVariable",
"object",
"from",
"its",
"data",
"model",
"representation",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/common/TemplateVariable.php#L138-L152 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/TemplateConstraintMarshaller.php | TemplateConstraintMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
$expressionElt = self::getFirstChildElement($element);
try {
return new TemplateConstraint($this->getMarshallerFactory()->createMarshaller($expressionElt)->unmarshall($expressionElt));
} catch (InvalidArgumentException $e) {
... | php | protected function unmarshall(DOMElement $element)
{
$expressionElt = self::getFirstChildElement($element);
try {
return new TemplateConstraint($this->getMarshallerFactory()->createMarshaller($expressionElt)->unmarshall($expressionElt));
} catch (InvalidArgumentException $e) {
... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"expressionElt",
"=",
"self",
"::",
"getFirstChildElement",
"(",
"$",
"element",
")",
";",
"try",
"{",
"return",
"new",
"TemplateConstraint",
"(",
"$",
"this",
"->",
"ge... | Unmarshall a DOMElement object corresponding to a QTI templateConstraint element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A TemplateConstraint object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"templateConstraint",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/TemplateConstraintMarshaller.php#L61-L73 |
oat-sa/qti-sdk | src/qtism/data/storage/Utils.php | Utils.stringToDatatype | public static function stringToDatatype($string, $baseType)
{
if (in_array($baseType, BaseType::asArray(), true)) {
$value = null;
switch ($baseType) {
case BaseType::BOOLEAN:
if (Format::isBoolean($string)) {
$value = (Format:... | php | public static function stringToDatatype($string, $baseType)
{
if (in_array($baseType, BaseType::asArray(), true)) {
$value = null;
switch ($baseType) {
case BaseType::BOOLEAN:
if (Format::isBoolean($string)) {
$value = (Format:... | [
"public",
"static",
"function",
"stringToDatatype",
"(",
"$",
"string",
",",
"$",
"baseType",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"baseType",
",",
"BaseType",
"::",
"asArray",
"(",
")",
",",
"true",
")",
")",
"{",
"$",
"value",
"=",
"null",
";... | Transform a string representing a QTI valueType value in a
the correct datatype.
@param string $string The QTI valueType value as a string.
@param integer $baseType The QTI baseType that defines the datatype of $string.
@return mixed A converted object/primitive type.
@throws \InvalidArgumentException If $baseType is ... | [
"Transform",
"a",
"string",
"representing",
"a",
"QTI",
"valueType",
"value",
"in",
"a",
"the",
"correct",
"datatype",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/Utils.php#L54-L176 |
oat-sa/qti-sdk | src/qtism/data/storage/Utils.php | Utils.stringToCoords | public static function stringToCoords($string, $shape)
{
if (Format::isCoords($string)) {
$stringCoords = explode(",", $string);
$intCoords = array();
foreach ($stringCoords as $sC) {
$intCoords[] = intval($sC);
}
// Maybe it was... | php | public static function stringToCoords($string, $shape)
{
if (Format::isCoords($string)) {
$stringCoords = explode(",", $string);
$intCoords = array();
foreach ($stringCoords as $sC) {
$intCoords[] = intval($sC);
}
// Maybe it was... | [
"public",
"static",
"function",
"stringToCoords",
"(",
"$",
"string",
",",
"$",
"shape",
")",
"{",
"if",
"(",
"Format",
"::",
"isCoords",
"(",
"$",
"string",
")",
")",
"{",
"$",
"stringCoords",
"=",
"explode",
"(",
"\",\"",
",",
"$",
"string",
")",
"... | Transforms a string to a Coord object according to a given shape.
@param string $string Coordinates as a string.
@param int $shape A value from the Shape enumeration.
@throws \InvalidArgumentException If $string is are not valid coordinates or $shape is not a value from the Shape enumeration.
@throws \UnexpectedValueE... | [
"Transforms",
"a",
"string",
"to",
"a",
"Coord",
"object",
"according",
"to",
"a",
"given",
"shape",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/Utils.php#L187-L204 |
oat-sa/qti-sdk | src/qtism/data/storage/Utils.php | Utils.sanitizeUri | public static function sanitizeUri($uri)
{
if (gettype($uri) === 'string') {
return rtrim($uri, '/');
}
$msg = "The uri argument must be a string, '" . gettype($uri) . "' given.";
throw new InvalidArgumentException($msg);
} | php | public static function sanitizeUri($uri)
{
if (gettype($uri) === 'string') {
return rtrim($uri, '/');
}
$msg = "The uri argument must be a string, '" . gettype($uri) . "' given.";
throw new InvalidArgumentException($msg);
} | [
"public",
"static",
"function",
"sanitizeUri",
"(",
"$",
"uri",
")",
"{",
"if",
"(",
"gettype",
"(",
"$",
"uri",
")",
"===",
"'string'",
")",
"{",
"return",
"rtrim",
"(",
"$",
"uri",
",",
"'/'",
")",
";",
"}",
"$",
"msg",
"=",
"\"The uri argument mus... | Sanitize a URI (Uniform Resource Identifier).
The following processings will be applied:
* If there is/are trailing slashe(s), they will be removed.
@param string $uri A Uniform Resource Identifier.
@throws \InvalidArgumentException If $uri is not a string.
@return string A sanitized Uniform Resource Identifier. | [
"Sanitize",
"a",
"URI",
"(",
"Uniform",
"Resource",
"Identifier",
")",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/Utils.php#L217-L225 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/custom/Implode.php | Implode.process | public function process()
{
$operands = $this->getOperands();
if (($c = count($operands)) < 2) {
$msg = "The 'qtism.runtime.expressions.operators.custom.Implode' 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.Implode' 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 implode function.
@return String 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",
"implode",
"function",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/custom/Implode.php#L51-L78 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/AnyNProcessor.php | AnyNProcessor.process | public function process()
{
$operands = $this->getOperands();
// Retrieve the values of min and max.
$min = $this->getExpression()->getMin();
$max = $this->getExpression()->getMax();
// @todo write a generic method to retrieve variable references.
if (is_string($mi... | php | public function process()
{
$operands = $this->getOperands();
// Retrieve the values of min and max.
$min = $this->getExpression()->getMin();
$max = $this->getExpression()->getMax();
// @todo write a generic method to retrieve variable references.
if (is_string($mi... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"// Retrieve the values of min and max.",
"$",
"min",
"=",
"$",
"this",
"->",
"getExpression",
"(",
")",
"->",
"getMin",
"(",
")",
";",
... | Process the AnyN processor.
@return boolean|null A boolean value of true if at least min of the sub-expressions are true and at most max of the sub-expressions are true. NULL is returned if the correct value for the operator cannot be determined.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException | [
"Process",
"the",
"AnyN",
"processor",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/AnyNProcessor.php#L61-L134 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/AreaMapEntryMarshaller.php | AreaMapEntryMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'shape', QtiShape::getNameByConstant($component->getShape()));
$this->setDOMElementAttribute($element, 'coords', $c... | php | protected function marshall(QtiComponent $component)
{
$element = static::getDOMCradle()->createElement($component->getQtiClassName());
$this->setDOMElementAttribute($element, 'shape', QtiShape::getNameByConstant($component->getShape()));
$this->setDOMElementAttribute($element, 'coords', $c... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"element",
"=",
"static",
"::",
"getDOMCradle",
"(",
")",
"->",
"createElement",
"(",
"$",
"component",
"->",
"getQtiClassName",
"(",
")",
")",
";",
"$",
"this",
"->... | Marshall an AreaMapEntry object into a DOMElement object.
@param \qtism\data\QtiComponent $component An AreaMapEntry object.
@return \DOMElement The according DOMElement object. | [
"Marshall",
"an",
"AreaMapEntry",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/AreaMapEntryMarshaller.php#L46-L55 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/AreaMapEntryMarshaller.php | AreaMapEntryMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
if (($shape = $this->getDOMElementAttributeAs($element, 'shape')) !== null) {
$shapeVal = QtiShape::getConstantByName($shape);
if ($shapeVal !== false) {
if (($coords = $this->getDOMElementAttributeAs($element, '... | php | protected function unmarshall(DOMElement $element)
{
if (($shape = $this->getDOMElementAttributeAs($element, 'shape')) !== null) {
$shapeVal = QtiShape::getConstantByName($shape);
if ($shapeVal !== false) {
if (($coords = $this->getDOMElementAttributeAs($element, '... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"if",
"(",
"(",
"$",
"shape",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"element",
",",
"'shape'",
")",
")",
"!==",
"null",
")",
"{",
"$",
"shapeVal",... | Unmarshall a DOMElement object corresponding to a QTI areaMapEntry element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent An AreaMapEntry object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"a",
"QTI",
"areaMapEntry",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/AreaMapEntryMarshaller.php#L64-L104 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/A.php | A.setHref | public function setHref($href)
{
if (Format::isUri($href) === true) {
$this->href = $href;
} else {
$msg = "The 'href' argument must be a URI, '" . $href . "' given.";
throw new InvalidArgumentException($msg);
}
} | php | public function setHref($href)
{
if (Format::isUri($href) === true) {
$this->href = $href;
} else {
$msg = "The 'href' argument must be a URI, '" . $href . "' given.";
throw new InvalidArgumentException($msg);
}
} | [
"public",
"function",
"setHref",
"(",
"$",
"href",
")",
"{",
"if",
"(",
"Format",
"::",
"isUri",
"(",
"$",
"href",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"href",
"=",
"$",
"href",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The 'href' ar... | Set the href attribute.
@param string $href A URI (Uniform Resource Identifier).
@throws InvalidArgumentException If $href is not a URI. | [
"Set",
"the",
"href",
"attribute",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/A.php#L79-L87 |
oat-sa/qti-sdk | src/qtism/data/content/xhtml/A.php | A.setType | public function setType($type)
{
if (is_string($type) === true) {
$this->type = $type;
} else {
$msg = "The 'type' argument must be a non-empty string representing a mime-type, '" . gettype($type) . "' given.";
throw new InvalidArgumentException($msg);
}
... | php | public function setType($type)
{
if (is_string($type) === true) {
$this->type = $type;
} else {
$msg = "The 'type' argument must be a non-empty string representing a mime-type, '" . gettype($type) . "' given.";
throw new InvalidArgumentException($msg);
}
... | [
"public",
"function",
"setType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"type",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"type",
"=",
"$",
"type",
";",
"}",
"else",
"{",
"$",
"msg",
"=",
"\"The 'type' argument must be a... | Set the type attribute (mime-type). Give an empty string
to indicate there is no mime-type.
@param string $type A mime-type.
@throws InvalidArgumentException If $type is not a string value. | [
"Set",
"the",
"type",
"attribute",
"(",
"mime",
"-",
"type",
")",
".",
"Give",
"an",
"empty",
"string",
"to",
"indicate",
"there",
"is",
"no",
"mime",
"-",
"type",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/xhtml/A.php#L106-L114 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/GapMarshaller.php | GapMarshaller.marshall | protected function marshall(QtiComponent $component)
{
$version = $this->getVersion();
$element = $this->createElement($component);
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
if ($component->isFixed() === true) {
$this->setDOMElem... | php | protected function marshall(QtiComponent $component)
{
$version = $this->getVersion();
$element = $this->createElement($component);
$this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
if ($component->isFixed() === true) {
$this->setDOMElem... | [
"protected",
"function",
"marshall",
"(",
"QtiComponent",
"$",
"component",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"$",
"element",
"=",
"$",
"this",
"->",
"createElement",
"(",
"$",
"component",
")",
";",
"$",
"t... | Marshall a Gap object into a DOMElement object.
@param \qtism\data\QtiComponent $component A Gap object.
@return \DOMElement The according DOMElement object.
@throws \qtism\data\storage\xml\marshalling\MarshallingException | [
"Marshall",
"a",
"Gap",
"object",
"into",
"a",
"DOMElement",
"object",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/GapMarshaller.php#L47-L79 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/GapMarshaller.php | GapMarshaller.unmarshall | protected function unmarshall(DOMElement $element)
{
$version = $this->getVersion();
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
$component = new Gap($identifier);
if (($fixed = $this->getDOMElementAttributeAs($element, 'fixed', '... | php | protected function unmarshall(DOMElement $element)
{
$version = $this->getVersion();
if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {
$component = new Gap($identifier);
if (($fixed = $this->getDOMElementAttributeAs($element, 'fixed', '... | [
"protected",
"function",
"unmarshall",
"(",
"DOMElement",
"$",
"element",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"if",
"(",
"(",
"$",
"identifier",
"=",
"$",
"this",
"->",
"getDOMElementAttributeAs",
"(",
"$",
"ele... | Unmarshall a DOMElement object corresponding to an XHTML gap element.
@param \DOMElement $element A DOMElement object.
@return \qtism\data\QtiComponent A Gap object.
@throws \qtism\data\storage\xml\marshalling\UnmarshallingException | [
"Unmarshall",
"a",
"DOMElement",
"object",
"corresponding",
"to",
"an",
"XHTML",
"gap",
"element",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/GapMarshaller.php#L88-L123 |
oat-sa/qti-sdk | src/qtism/runtime/rules/RuleProcessor.php | RuleProcessor.setRule | public function setRule(Rule $rule)
{
$expectedType = $this->getRuleType();
if (Reflection::isInstanceOf($rule, $expectedType) === true) {
$this->rule = $rule;
} else {
$procClass = get_class($this);
$givenType = get_class($rule);
$msg... | php | public function setRule(Rule $rule)
{
$expectedType = $this->getRuleType();
if (Reflection::isInstanceOf($rule, $expectedType) === true) {
$this->rule = $rule;
} else {
$procClass = get_class($this);
$givenType = get_class($rule);
$msg... | [
"public",
"function",
"setRule",
"(",
"Rule",
"$",
"rule",
")",
"{",
"$",
"expectedType",
"=",
"$",
"this",
"->",
"getRuleType",
"(",
")",
";",
"if",
"(",
"Reflection",
"::",
"isInstanceOf",
"(",
"$",
"rule",
",",
"$",
"expectedType",
")",
"===",
"true... | Set the QTI Data Model Rule object to be processed.
@param \qtism\runtime\rules\Rule $rule
@throws \InvalidArgumentException If $rule is not compliant with the rule processor implementation. | [
"Set",
"the",
"QTI",
"Data",
"Model",
"Rule",
"object",
"to",
"be",
"processed",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rules/RuleProcessor.php#L77-L89 |
oat-sa/qti-sdk | src/qtism/common/storage/MemoryStream.php | MemoryStream.open | public function open()
{
if ($this->isOpen() === true) {
$msg = "The MemoryStream is already open.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::ALREADY_OPEN);
}
$this->setOpen(true);
} | php | public function open()
{
if ($this->isOpen() === true) {
$msg = "The MemoryStream is already open.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::ALREADY_OPEN);
}
$this->setOpen(true);
} | [
"public",
"function",
"open",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpen",
"(",
")",
"===",
"true",
")",
"{",
"$",
"msg",
"=",
"\"The MemoryStream is already open.\"",
";",
"throw",
"new",
"MemoryStreamException",
"(",
"$",
"msg",
",",
"$",
"th... | Open the binary stream.
@throws \qtism\common\storage\MemoryStreamException If the stream is already opened. | [
"Open",
"the",
"binary",
"stream",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/storage/MemoryStream.php#L147-L155 |
oat-sa/qti-sdk | src/qtism/common/storage/MemoryStream.php | MemoryStream.close | public function close()
{
if ($this->isOpen() === false) {
$msg = "Cannot call close() a closed stream.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::NOT_OPEN);
}
$this->setOpen(false);
} | php | public function close()
{
if ($this->isOpen() === false) {
$msg = "Cannot call close() a closed stream.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::NOT_OPEN);
}
$this->setOpen(false);
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpen",
"(",
")",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
"\"Cannot call close() a closed stream.\"",
";",
"throw",
"new",
"MemoryStreamException",
"(",
"$",
"msg",
",",
"$",
... | Close the binary stream.
@throws \qtism\common\storage\MemoryStreamException If the stream is closed prior the call. | [
"Close",
"the",
"binary",
"stream",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/storage/MemoryStream.php#L162-L170 |
oat-sa/qti-sdk | src/qtism/common/storage/MemoryStream.php | MemoryStream.read | public function read($length)
{
if ($this->isOpen() === false) {
$msg = "Cannot read from a closed MemoryStream.";
throw new MemoryStreamAccess($msg, $this, MemoryStreamException::NOT_OPEN);
}
if ($length === 0) {
return '';
}
$po... | php | public function read($length)
{
if ($this->isOpen() === false) {
$msg = "Cannot read from a closed MemoryStream.";
throw new MemoryStreamAccess($msg, $this, MemoryStreamException::NOT_OPEN);
}
if ($length === 0) {
return '';
}
$po... | [
"public",
"function",
"read",
"(",
"$",
"length",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpen",
"(",
")",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
"\"Cannot read from a closed MemoryStream.\"",
";",
"throw",
"new",
"MemoryStreamAccess",
"(",
"$",
"ms... | Read $length bytes from the MemoryStream.
@throws \qtism\common\storage\MemoryStreamException If the read is out of the bounds of the stream e.g. EOF reach.
@return string The read value or an empty string if length = 0. | [
"Read",
"$length",
"bytes",
"from",
"the",
"MemoryStream",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/storage/MemoryStream.php#L178-L207 |
oat-sa/qti-sdk | src/qtism/common/storage/MemoryStream.php | MemoryStream.write | public function write($data)
{
if ($this->isOpen() === false) {
$msg = "Cannot write in a closed MemoryStream.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::NOT_OPEN);
}
if ($this->length - 1 === $this->position) {
// simpl... | php | public function write($data)
{
if ($this->isOpen() === false) {
$msg = "Cannot write in a closed MemoryStream.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::NOT_OPEN);
}
if ($this->length - 1 === $this->position) {
// simpl... | [
"public",
"function",
"write",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpen",
"(",
")",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
"\"Cannot write in a closed MemoryStream.\"",
";",
"throw",
"new",
"MemoryStreamException",
"(",
"$",
"m... | Write some $data in the stream.
@param string $data | [
"Write",
"some",
"$data",
"in",
"the",
"stream",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/storage/MemoryStream.php#L214-L239 |
oat-sa/qti-sdk | src/qtism/common/storage/MemoryStream.php | MemoryStream.rewind | public function rewind()
{
if ($this->isOpen() === false) {
$msg = "Cannot call rewind() on a closed MemoryStream.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::NOT_OPEN);
}
$this->setPosition(0);
} | php | public function rewind()
{
if ($this->isOpen() === false) {
$msg = "Cannot call rewind() on a closed MemoryStream.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::NOT_OPEN);
}
$this->setPosition(0);
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpen",
"(",
")",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
"\"Cannot call rewind() on a closed MemoryStream.\"",
";",
"throw",
"new",
"MemoryStreamException",
"(",
"$",
"msg",
"... | Rewind the stream to its initial position.
@throws \qtism\common\storage\MemoryStreamException If the binary stream is not open. | [
"Rewind",
"the",
"stream",
"to",
"its",
"initial",
"position",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/storage/MemoryStream.php#L266-L274 |
oat-sa/qti-sdk | src/qtism/common/storage/MemoryStream.php | MemoryStream.flush | public function flush()
{
if ($this->isOpen() === true) {
$this->setBinary('');
$this->rewind();
} else {
$msg = "Cannot flush a closed MemoryStream.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::NOT_OPEN);
}
} | php | public function flush()
{
if ($this->isOpen() === true) {
$this->setBinary('');
$this->rewind();
} else {
$msg = "Cannot flush a closed MemoryStream.";
throw new MemoryStreamException($msg, $this, MemoryStreamException::NOT_OPEN);
}
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpen",
"(",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"setBinary",
"(",
"''",
")",
";",
"$",
"this",
"->",
"rewind",
"(",
")",
";",
"}",
"else",
"{",
"$",
"... | Flush the whole stream.
@throws \qtism\common\storage\MemoryStreamException If the binary stream is closed. | [
"Flush",
"the",
"whole",
"stream",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/storage/MemoryStream.php#L291-L300 |
oat-sa/qti-sdk | src/qtism/runtime/expressions/operators/EqualRoundedProcessor.php | EqualRoundedProcessor.process | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull()) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The EqualRounded operator only accepts operands with a single cardinality.";
thr... | php | public function process()
{
$operands = $this->getOperands();
if ($operands->containsNull()) {
return null;
}
if ($operands->exclusivelySingle() === false) {
$msg = "The EqualRounded operator only accepts operands with a single cardinality.";
thr... | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"operands",
"=",
"$",
"this",
"->",
"getOperands",
"(",
")",
";",
"if",
"(",
"$",
"operands",
"->",
"containsNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"operands",
"->... | Process the EqualRounded operator.
@return boolean|null A boolean with a value of true if the two expressions are numerically equal after rounding and false if they are not. If either sub-expression is NULL, the operator results in NULL.
@throws \qtism\runtime\expressions\operators\OperatorProcessingException | [
"Process",
"the",
"EqualRounded",
"operator",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/expressions/operators/EqualRoundedProcessor.php#L69-L126 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/MarshallerFactory.php | MarshallerFactory.addMappingEntry | public function addMappingEntry($qtiClassName, $marshallerClassName, $ns = 'qtism')
{
$mapping = &$this->getMapping();
$mapping[$ns][$qtiClassName] = $marshallerClassName;
} | php | public function addMappingEntry($qtiClassName, $marshallerClassName, $ns = 'qtism')
{
$mapping = &$this->getMapping();
$mapping[$ns][$qtiClassName] = $marshallerClassName;
} | [
"public",
"function",
"addMappingEntry",
"(",
"$",
"qtiClassName",
",",
"$",
"marshallerClassName",
",",
"$",
"ns",
"=",
"'qtism'",
")",
"{",
"$",
"mapping",
"=",
"&",
"$",
"this",
"->",
"getMapping",
"(",
")",
";",
"$",
"mapping",
"[",
"$",
"ns",
"]",... | Add a mapping entry for a given tuple $qtiClassName <-> $marshallerClassName.
@param string $qtiClassName A QTI class name.
@param string $marshallerClassName A PHP marshaller class name (fully qualified).
@param string $ns | [
"Add",
"a",
"mapping",
"entry",
"for",
"a",
"given",
"tuple",
"$qtiClassName",
"<",
"-",
">",
"$marshallerClassName",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/MarshallerFactory.php#L314-L318 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/MarshallerFactory.php | MarshallerFactory.hasMappingEntry | public function hasMappingEntry($qtiClassName, $ns = 'qtism')
{
$mapping = &$this->getMapping();
return isset($mapping[$ns]) && isset($mapping[$ns][$qtiClassName]);
} | php | public function hasMappingEntry($qtiClassName, $ns = 'qtism')
{
$mapping = &$this->getMapping();
return isset($mapping[$ns]) && isset($mapping[$ns][$qtiClassName]);
} | [
"public",
"function",
"hasMappingEntry",
"(",
"$",
"qtiClassName",
",",
"$",
"ns",
"=",
"'qtism'",
")",
"{",
"$",
"mapping",
"=",
"&",
"$",
"this",
"->",
"getMapping",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"mapping",
"[",
"$",
"ns",
"]",
")",
... | Whether a mapping entry is defined for a given $qtiClassName.
@param string $qtiClassName A QTI class name.
@param string $ns
@return boolean Whether a mapping entry is defined. | [
"Whether",
"a",
"mapping",
"entry",
"is",
"defined",
"for",
"a",
"given",
"$qtiClassName",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/MarshallerFactory.php#L327-L332 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/MarshallerFactory.php | MarshallerFactory.removeMappingEntry | public function removeMappingEntry($qtiClassName, $ns = 'qtism')
{
$mapping = &$this->getMapping();
if ($this->hasMappingEntry($qtiClassName, $ns)) {
unset($mapping[$ns][$qtiClassName]);
}
} | php | public function removeMappingEntry($qtiClassName, $ns = 'qtism')
{
$mapping = &$this->getMapping();
if ($this->hasMappingEntry($qtiClassName, $ns)) {
unset($mapping[$ns][$qtiClassName]);
}
} | [
"public",
"function",
"removeMappingEntry",
"(",
"$",
"qtiClassName",
",",
"$",
"ns",
"=",
"'qtism'",
")",
"{",
"$",
"mapping",
"=",
"&",
"$",
"this",
"->",
"getMapping",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasMappingEntry",
"(",
"$",
"qtiCla... | Remove a mapping for $qtiClassName.
@param string $qtiClassName A QTI class name.
@param string $ns | [
"Remove",
"a",
"mapping",
"for",
"$qtiClassName",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/MarshallerFactory.php#L354-L361 |
oat-sa/qti-sdk | src/qtism/data/storage/xml/marshalling/MarshallerFactory.php | MarshallerFactory.createMarshaller | public function createMarshaller($object, array $args = array())
{
if ($object instanceof QtiComponent) {
// Asking for a Marshaller...
$qtiClassName = $object->getQtiClassName();
if ($this->isWebComponentFriendly() === true && in_array($qtiClassName, Marshal... | php | public function createMarshaller($object, array $args = array())
{
if ($object instanceof QtiComponent) {
// Asking for a Marshaller...
$qtiClassName = $object->getQtiClassName();
if ($this->isWebComponentFriendly() === true && in_array($qtiClassName, Marshal... | [
"public",
"function",
"createMarshaller",
"(",
"$",
"object",
",",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"QtiComponent",
")",
"{",
"// Asking for a Marshaller...",
"$",
"qtiClassName",
"=",
"$",
"obje... | Create a marshaller for a given QtiComponent or DOMElement object, depending on the current mapping
of the MarshallerFactory. If no mapping entry can be found, the factory will perform a ultimate
trial in the qtism\\data\\storage\\xml\\marshalling namespace to find the relevant Marshaller object.
The newly created mar... | [
"Create",
"a",
"marshaller",
"for",
"a",
"given",
"QtiComponent",
"or",
"DOMElement",
"object",
"depending",
"on",
"the",
"current",
"mapping",
"of",
"the",
"MarshallerFactory",
".",
"If",
"no",
"mapping",
"entry",
"can",
"be",
"found",
"the",
"factory",
"will... | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/storage/xml/marshalling/MarshallerFactory.php#L402-L445 |
oat-sa/qti-sdk | src/qtism/runtime/rendering/css/Utils.php | Utils.mapSelector | public static function mapSelector($selector, array $map)
{
foreach ($map as $k => $v) {
$pattern = "/(?:(^|\s|\+|,|~|>)(${k})(\$|\s|,|\+|\.|\~|>|:|\[))/u";
$count = 1;
while ($count > 0) {
$selector = preg_replace($pattern, '$1.' . $v . ... | php | public static function mapSelector($selector, array $map)
{
foreach ($map as $k => $v) {
$pattern = "/(?:(^|\s|\+|,|~|>)(${k})(\$|\s|,|\+|\.|\~|>|:|\[))/u";
$count = 1;
while ($count > 0) {
$selector = preg_replace($pattern, '$1.' . $v . ... | [
"public",
"static",
"function",
"mapSelector",
"(",
"$",
"selector",
",",
"array",
"$",
"map",
")",
"{",
"foreach",
"(",
"$",
"map",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"pattern",
"=",
"\"/(?:(^|\\s|\\+|,|~|>)(${k})(\\$|\\s|,|\\+|\\.|\\~|>|:|\\[))/u... | Remap a given CSS selector following the $map array.
Example:
<code>
$map = array('prompt' => 'qti-prompt', 'div' => 'qti-div');
$selector = 'div > prompt';
echo Utils::mapSelector($selector, $map);
// .qti-div > .qti-prompt
</code>
@param string $selector A Cascading Style Sheet selector.
@param array $map A QTI to... | [
"Remap",
"a",
"given",
"CSS",
"selector",
"following",
"the",
"$map",
"array",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/runtime/rendering/css/Utils.php#L51-L64 |
oat-sa/qti-sdk | src/qtism/common/utils/Php.php | Php.displayType | static public function displayType($value)
{
if (is_null($value) === true) {
return 'null';
} elseif (is_object($value) === true) {
return get_class($value);
} else {
return 'php:' . gettype($value);
}
} | php | static public function displayType($value)
{
if (is_null($value) === true) {
return 'null';
} elseif (is_object($value) === true) {
return get_class($value);
} else {
return 'php:' . gettype($value);
}
} | [
"static",
"public",
"function",
"displayType",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
"===",
"true",
")",
"{",
"return",
"'null'",
";",
"}",
"elseif",
"(",
"is_object",
"(",
"$",
"value",
")",
"===",
"true",
")",
... | Returns a displayable datatype for any $value.
Example:
echo Php::displayType(null);
echo Php::displayType(12);
echo Php::displayType(12.1);
echo Php::displayType(new stdClass());
// null
// php:integer
// php:double
// stdClass
@param mixed $value
@return string | [
"Returns",
"a",
"displayable",
"datatype",
"for",
"any",
"$value",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/common/utils/Php.php#L43-L52 |
oat-sa/qti-sdk | src/qtism/data/content/interactions/HottextInteraction.php | HottextInteraction.setMinChoices | public function setMinChoices($minChoices)
{
if (is_int($minChoices) && $minChoices > 0) {
if ($minChoices > $this->getMaxChoices() && $this->getMaxChoices() > 0) {
$msg = "The 'minChoices' argument must respect the limits imposed by 'maxChoices'.";
throw new Inv... | php | public function setMinChoices($minChoices)
{
if (is_int($minChoices) && $minChoices > 0) {
if ($minChoices > $this->getMaxChoices() && $this->getMaxChoices() > 0) {
$msg = "The 'minChoices' argument must respect the limits imposed by 'maxChoices'.";
throw new Inv... | [
"public",
"function",
"setMinChoices",
"(",
"$",
"minChoices",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"minChoices",
")",
"&&",
"$",
"minChoices",
">",
"0",
")",
"{",
"if",
"(",
"$",
"minChoices",
">",
"$",
"this",
"->",
"getMaxChoices",
"(",
")",
"... | Set the minimum number of choices that the candidate is required to select to form a valid response.
@param integer $minChoices A positive (>= 0) integer.
@throws \InvalidArgumentException If $minChoices is not a positive integer or does not respect the limits imposed by maxChoices. | [
"Set",
"the",
"minimum",
"number",
"of",
"choices",
"that",
"the",
"candidate",
"is",
"required",
"to",
"select",
"to",
"form",
"a",
"valid",
"response",
"."
] | train | https://github.com/oat-sa/qti-sdk/blob/fc3568d2a293ae6dbfe9f400dad2b94a0033ddb2/src/qtism/data/content/interactions/HottextInteraction.php#L137-L153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.