idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
3,200
protected function init ( $ id , $ file ) { $ this -> setState ( self :: RUNNING ) ; $ this -> setId ( $ id ) ; $ this -> setBuffer ( array ( ) ) ; $ this -> setOutput ( '' ) ; $ this -> setPreviousChar ( false ) ; $ this -> setPreviousSignificantChar ( false ) ; if ( ( $ data = @ file_get_contents ( $ file ) ) !== fal...
Initialize the object to be ready for a new rescoping .
3,201
protected function afterCharReading ( $ char ) { $ this -> setPreviousChar ( $ char ) ; if ( self :: isWhiteSpace ( $ char ) === false ) { $ this -> setPreviousSignificantChar ( $ char ) ; } }
Instructions to perform after any character read .
3,202
protected function runningState ( ) { $ char = $ this -> getCurrentChar ( ) ; if ( $ char === self :: CHAR_AT ) { $ this -> setState ( self :: IN_ATRULE ) ; $ this -> bufferize ( $ char ) ; $ this -> output ( $ char ) ; } elseif ( $ char === self :: CHAR_STAR && $ this -> getPreviousChar ( ) === self :: CHAR_SLASH ) { ...
Instructions to be performed in running state .
3,203
protected function inAtRuleState ( ) { $ char = $ this -> getCurrentChar ( ) ; if ( $ char === self :: CHAR_DOUBLEQUOTE ) { $ this -> setState ( self :: IN_ATRULESTRING ) ; } elseif ( $ char === self :: CHAR_TERMINATOR ) { $ this -> setState ( self :: RUNNING ) ; $ this -> cleanBuffer ( ) ; } elseif ( $ char === self :...
Instructions to be performed in atRule state .
3,204
protected function inAtRuleStringState ( ) { $ char = $ this -> getCurrentChar ( ) ; if ( $ char === self :: CHAR_DOUBLEQUOTE && $ this -> isEscaping ( ) === false ) { $ this -> cleanBuffer ( ) ; $ this -> setState ( self :: IN_ATRULE ) ; } elseif ( $ char === self :: CHAR_ESCAPE ) { $ this -> bufferize ( $ char ) ; } ...
Instructions to be performed in atRuleString state .
3,205
protected function inAtRuleBodyState ( ) { $ char = $ this -> getCurrentChar ( ) ; if ( $ char === self :: CHAR_CLOSINGBRACE ) { $ buffer = implode ( '' , $ this -> getBuffer ( ) ) ; $ openingCount = substr_count ( $ buffer , self :: CHAR_OPENINGBRACE ) ; $ closingCount = substr_count ( $ buffer , self :: CHAR_CLOSINGB...
Instructions to be performed in atRuleBody state .
3,206
protected function inSelectorState ( ) { $ char = $ this -> getCurrentChar ( ) ; if ( $ char === self :: CHAR_OPENINGBRACE ) { $ this -> updateSelector ( ) ; $ this -> cleanBuffer ( ) ; $ this -> setState ( self :: IN_CLASSBODY ) ; } else { $ this -> bufferize ( $ char ) ; } }
Instructions to be performed in selector state .
3,207
protected function inClassBodyState ( ) { $ char = $ this -> getCurrentChar ( ) ; if ( $ char === self :: CHAR_DOUBLEQUOTE ) { $ this -> setState ( self :: IN_CLASSSTRING ) ; } elseif ( $ char === self :: CHAR_CLOSINGBRACE ) { $ this -> setState ( self :: RUNNING ) ; } elseif ( $ char === self :: CHAR_STAR && $ this ->...
Instructions to be performed in classBody state .
3,208
protected function inMainCommentState ( ) { $ char = $ this -> getCurrentChar ( ) ; if ( $ char === self :: CHAR_SLASH && $ this -> getPreviousChar ( ) === self :: CHAR_STAR ) { $ this -> setState ( self :: RUNNING ) ; } $ this -> output ( $ char ) ; }
Instructions to be performed in mainComment state .
3,209
protected function inClassCommentState ( ) { $ char = $ this -> getCurrentChar ( ) ; if ( $ char === self :: CHAR_SLASH && $ this -> getPreviousChar ( ) === self :: CHAR_STAR ) { $ this -> setState ( self :: IN_CLASSBODY ) ; } $ this -> output ( $ char ) ; }
Instructions to be performed in classComment state .
3,210
protected function inClassStringState ( ) { $ char = $ this -> getCurrentChar ( ) ; if ( $ char === self :: CHAR_DOUBLEQUOTE && $ this -> isEscaping ( ) === false ) { $ this -> cleanBuffer ( ) ; $ this -> setState ( self :: IN_CLASSBODY ) ; } elseif ( $ char === self :: CHAR_ESCAPE ) { $ this -> bufferize ( $ char ) ; ...
Instructions to be performed in classString state .
3,211
protected function updateSelector ( ) { $ buffer = implode ( '' , $ this -> getBuffer ( ) ) ; $ qtiClassMap = ( $ this -> isWebComponentFriendly ( ) ) ? array_merge ( self :: $ qtiClassMapping , self :: $ wcFriendlyQtiClassMapping ) : self :: $ qtiClassMapping ; if ( strpos ( $ buffer , ',' ) === false ) { if ( strpos ...
Update selector implementation .
3,212
protected function marshallChildrenKnown ( QtiComponent $ component , array $ elements ) { $ element = self :: getDOMCradle ( ) -> createElement ( $ component -> getQtiClassName ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'figures' , $ component -> getFigures ( ) ) ; $ this -> setDOMElementAttribute ( $ elem...
Unmarshall a RoundTo object into a QTI roundTo element .
3,213
protected function unmarshallChildrenKnown ( DOMElement $ element , QtiComponentCollection $ children ) { if ( ( $ figures = $ this -> getDOMElementAttributeAs ( $ element , 'figures' , 'string' ) ) !== null ) { if ( ! Format :: isVariableRef ( $ figures ) ) { $ figures = intval ( $ figures ) ; } $ object = new RoundTo...
Unmarshall a QTI roundTo operator element into a RoundTo object .
3,214
public function process ( ) { $ expr = $ this -> getExpression ( ) ; $ min = $ expr -> getMin ( ) ; $ max = $ expr -> getMax ( ) ; $ step = $ expr -> getStep ( ) ; $ state = $ this -> getState ( ) ; $ min = ( gettype ( $ min ) === 'integer' ) ? $ min : $ state [ Utils :: sanitizeVariableRef ( $ min ) ] -> getValue ( ) ...
Process the RandomInteger expression .
3,215
public function setSpan ( $ span ) { if ( is_int ( $ span ) === true && $ span > 0 ) { $ this -> span = $ span ; } else { $ msg = "The 'span' attribute must be a strictly positive (> 0) integer, '" . gettype ( $ span ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the span attribute .
3,216
public function setInterpretation ( $ interpretation ) { if ( gettype ( $ interpretation ) === 'string' ) { $ this -> interpretation = $ interpretation ; } else { $ msg = "Interpretation must be a string, '" . gettype ( $ interpretation ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the human interpretation of the outcome variable s value .
3,217
public function setMasteryValue ( $ masteryValue ) { if ( is_numeric ( $ masteryValue ) || ( is_bool ( $ masteryValue ) && $ masteryValue === false ) ) { $ this -> masteryValue = $ masteryValue ; } else { $ msg = "MasteryValue must be a number or (boolean) false, '" . gettype ( $ masteryValue ) . "' given." ; throw new...
Set the mastery value . Set to false if not specified .
3,218
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> sameBaseType ( ) === false ) { $ msg = "The Delete operator only accepts operands with the same baseType." ; throw new OperatorProcessingException ( $ msg , $ this ,...
Process the Delete operator .
3,219
public function setGapImgs ( GapImgCollection $ gapImgs ) { if ( count ( $ gapImgs ) > 0 ) { $ this -> gapImgs = $ gapImgs ; } else { $ msg = "A GraphicGapMatch interaction must composed of at least 1 GapImg object, none given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the list of choices for filling the gaps .
3,220
public function setAssociableHotspots ( AssociableHotspotCollection $ associableHotspots ) { if ( count ( $ associableHotspots ) > 0 ) { $ this -> associableHotspots = $ associableHotspots ; } else { $ msg = "A GraphicGapMatch interaction must be composed of at least 1 AssociableHotspot object, none given." ; throw new...
Set the hotspots that define the gaps that are to be filled by the candidate .
3,221
public function setPositionObjectInteractions ( PositionObjectInteractionCollection $ positionObjectInteractions ) { if ( count ( $ positionObjectInteractions ) > 0 ) { $ this -> positionObjectInteractions = $ positionObjectInteractions ; } else { $ msg = "A PositionObjectStage object must be composed of at least 1 Pos...
Set the positionObjectInteractions composing the positionObjectStage .
3,222
protected function marshall ( QtiComponent $ component ) { $ element = $ this -> createElement ( $ component ) ; $ this -> fillElement ( $ element , $ component ) ; $ this -> setDOMElementAttribute ( $ element , 'responseIdentifier' , $ component -> getResponseIdentifier ( ) ) ; $ this -> setDOMElementAttribute ( $ ele...
Marshall a SliderInteraction object into a DOMElement object .
3,223
protected function unmarshall ( DOMElement $ element ) { if ( ( $ responseIdentifier = $ this -> getDOMElementAttributeAs ( $ element , 'responseIdentifier' ) ) !== null ) { if ( ( $ lowerBound = $ this -> getDOMElementAttributeAs ( $ element , 'lowerBound' , 'float' ) ) !== null ) { if ( ( $ upperBound = $ this -> get...
Unmarshall a DOMElement object corresponding to a SliderInteraction element .
3,224
protected function pushOnTrail ( QtiComponent $ source , QtiComponentCollection $ components ) { foreach ( array_reverse ( $ components -> getArrayCopy ( ) ) as $ c ) { array_push ( $ this -> trail , array ( $ source , $ c ) ) ; $ this -> trailCount ++ ; } }
Push a trail entry on the trail .
3,225
public function next ( ) { if ( $ this -> trailCount > 0 ) { while ( $ this -> trailCount > 0 ) { $ trailEntry = $ this -> popFromTrail ( ) ; $ component = $ trailEntry [ 1 ] ; $ source = $ trailEntry [ 0 ] ; if ( $ this -> isTraversed ( $ component ) === false ) { $ this -> currentComponent = $ component ; $ this -> c...
Moves the current position to the next QtiComponent object to be traversed .
3,226
protected static function resolveAssessmentSectionRef ( AssessmentSectionRef $ assessmentSectionRef , FileResolver $ resolver ) { try { $ href = $ resolver -> resolve ( $ assessmentSectionRef -> getHref ( ) ) ; $ doc = new XmlDocument ( ) ; $ doc -> load ( $ href ) ; $ doc -> xInclude ( ) ; return $ doc ; } catch ( Xml...
Dereference the file referenced by an assessmentSectionRef .
3,227
public function setOperands ( OperandsCollection $ operands ) { $ min = $ this -> getExpression ( ) -> getMinOperands ( ) ; $ given = count ( $ operands ) ; if ( $ given < $ min ) { $ msg = "The Operator to be processed '" . get_class ( $ this ) . "' requires at least ${min} operand(s). " ; $ msg .= "${given} operand(s...
Set the collection of QTI Runtime compliant values to be used as the operands of the Operator to be processed .
3,228
protected function marshall ( QtiComponent $ component ) { $ element = self :: getDOMCradle ( ) -> createElement ( 'param' ) ; $ this -> setDOMElementAttribute ( $ element , 'name' , $ component -> getName ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'value' , $ component -> getValue ( ) ) ; $ this -> setDOME...
Marshall a Param object into a DOMElement object .
3,229
protected function unmarshall ( DOMElement $ element ) { if ( ( $ name = $ this -> getDOMElementAttributeAs ( $ element , 'name' ) ) === null ) { $ name = '' ; } if ( ( $ value = $ this -> getDOMElementAttributeAs ( $ element , 'value' ) ) === null ) { $ value = '' ; } if ( ( $ valueType = $ this -> getDOMElementAttrib...
Unmarshall a DOMElement object corresponding to an XHTML param element .
3,230
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The IntegerToFloat operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( ...
Process the IntegerToFloat operator .
3,231
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The Truncate operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( $ msg ...
Process the Truncate operator .
3,232
public function setExpression ( Expression $ expression ) { $ expectedType = $ this -> getExpressionType ( ) ; if ( ReflectionUtils :: isInstanceOf ( $ expression , $ expectedType ) === true ) { $ this -> expression = $ expression ; } else { $ procClass = get_class ( $ this ) ; $ givenType = get_class ( $ expression ) ...
Set the QTI Data Model Expression to be processed .
3,233
public function setCardinality ( $ cardinality ) { if ( in_array ( $ cardinality , Cardinality :: asArray ( ) ) ) { $ this -> cardinality = $ cardinality ; } else { $ msg = "The cardinality must be a value from the Cardinality enumeration." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the cardinality of the variable .
3,234
public function render ( $ component , $ base = '' ) { $ renderingEngine = $ this -> getRenderingEngine ( ) ; $ doc = $ renderingEngine -> getDocument ( ) ; $ fragment = $ doc -> createDocumentFragment ( ) ; $ this -> renderingImplementation ( $ fragment , $ component , $ base ) ; if ( $ component instanceof Stylesheet...
Render a QtiComponent into a DOMDocumentFragment that will be registered in the current rendering context .
3,235
public function additionalClass ( $ additionalClass ) { $ additionalClasses = $ this -> getAdditionalClasses ( ) ; if ( ( $ key = array_search ( $ additionalClass , $ additionalClasses ) ) !== false ) { unset ( $ additionalClasses [ $ key ] ) ; } $ additionalClasses [ ] = $ additionalClass ; $ this -> setAdditionalClas...
Add an additional CSS class to be rendered .
3,236
public function additionalUserClass ( $ additionalUserClass ) { $ additionalClasses = $ this -> getAdditionalUserClasses ( ) ; if ( ( $ key = array_search ( $ additionalUserClass , $ additionalClasses ) ) !== false ) { unset ( $ additionalClasses [ $ key ] ) ; } $ additionalClasses [ ] = $ additionalUserClass ; $ this ...
Add an additional user CSS class to be rendered .
3,237
public function setToleranceMode ( $ toleranceMode ) { if ( in_array ( $ toleranceMode , ToleranceMode :: asArray ( ) , true ) ) { $ this -> toleranceMode = $ toleranceMode ; } else { $ msg = "The toleranceMode argument must be a value from the ToleranceMode enumeration, '" . $ toleranceMode . "' given." ; throw new In...
Set the tolerance mode .
3,238
public function setIncludeLowerBound ( $ includeLowerBound ) { if ( is_bool ( $ includeLowerBound ) ) { $ this -> includeLowerBound = $ includeLowerBound ; } else { $ msg = "The includeLowerBound argument must be a boolean, '" . gettype ( $ includeLowerBound ) . "' given." ; throw new InvalidArgumentException ( $ msg )...
Set whether or not the lower bound must be included in the comparison .
3,239
public function setIncludeUpperBound ( $ includeUpperBound ) { if ( is_bool ( $ includeUpperBound ) ) { $ this -> includeUpperBound = $ includeUpperBound ; } else { $ msg = "The includeUpperBound argument must be a boolean, '" . gettype ( $ includeUpperBound ) . "' given." ; throw new InvalidArgumentException ( $ msg )...
Set whether or not the upper bound must be included in the comparison .
3,240
public function setFormat ( $ format ) { if ( Format :: isString256 ( $ format ) === true ) { $ this -> format = $ format ; } else { $ msg = "The 'format' argument must be a string with at most 256 characters, '" . $ format . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the format conversion to use when converting numerical values to strings .
3,241
public function setBase ( $ base ) { if ( is_int ( $ base ) === true || Format :: isVariableRef ( $ base ) === true ) { $ this -> base = $ base ; } else { $ msg = "The 'base' argument must be an integer or a variable reference, '" . $ base . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the number base to use when converting integer variables to strings .
3,242
public function setIndex ( $ index ) { if ( is_int ( $ index ) === true || Format :: isVariableRef ( $ index ) === true ) { $ this -> index = $ index ; } else { $ msg = "The 'index' argument must be an integer or a variable reference, '" . $ index . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the index to use when displaying a variable of ordered cardinality . Give a negative integer if there is no index indicated .
3,243
public function setDelimiter ( $ delimiter ) { if ( empty ( $ delimiter ) === false && Format :: isString256 ( $ delimiter ) === true ) { $ this -> delimiter = $ delimiter ; } else { $ msg = "The 'delimiter' argument must be a non-empty string, '" . gettype ( $ delimiter ) . "' given." ; throw new InvalidArgumentExcept...
Set the delimiter to use between values when displaying variables of ordered multiple or record cardinality .
3,244
public function setField ( $ field ) { if ( Format :: isString256 ( $ field ) === true ) { $ this -> field = $ field ; } else { $ msg = "The 'field' argument must be a non-empty string, '" . gettype ( $ field ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the field specifier to use when displaying variables of record cardinality . Give an empty string if no field is indicated .
3,245
public function setMappingIndicator ( $ mappingIndicator ) { if ( empty ( $ mappingIndicator ) === false && Format :: isString256 ( $ mappingIndicator ) === true ) { $ this -> mappingIndicator = $ mappingIndicator ; } else { $ msg = "The 'mappingIndicator' argument must be a non-empty string with at most 256 characters...
Set the mapping indicator to use between field name and field value when displaying variables of record cardinality .
3,246
public function setMatchTableEntries ( MatchTableEntryCollection $ matchTableEntries ) { if ( count ( $ matchTableEntries ) > 0 ) { $ this -> matchTableEntries = $ matchTableEntries ; } else { $ msg = "A MatchTable object must contain at least one MatchTableEntry object." ; throw new InvalidArgumentException ( $ msg ) ...
Set the collection of MatchTableEntry objects .
3,247
public static function isIdentifier ( $ string , $ strict = true ) { if ( $ strict === true ) { $ letter = self :: getPerlXmlLetter ( ) ; $ digit = self :: getPerlXmlDigit ( ) ; $ combiningChar = self :: getPerlXmlCombiningChar ( ) ; $ extender = self :: getPerlXmlExtender ( ) ; $ string = str_split ( $ string ) ; $ fi...
Check if string is compliant with the identifier datatype of IMS QTI .
3,248
public static function isVariableRef ( $ string ) { $ firstBrace = substr ( $ string , 0 , 1 ) ; $ secondBrace = substr ( $ string , - 1 ) ; if ( $ firstBrace == '{' && $ secondBrace == '}' ) { return self :: isIdentifier ( substr ( $ string , 1 , - 1 ) ) ; } else { return self :: isIdentifier ( $ string ) ; } }
Whether or not a given string is a variable ref .
3,249
public static function isPrintfIsoFormat ( $ isoFormat ) { $ subPattern = self :: getPrintfFormatSpecifier ( ) ; $ pattern = '/(?:(?:[^%]|^)(?:%%)+(' . $ subPattern . '))|(?:(?:[^%])(' . $ subPattern . '))|(?:^(' . $ subPattern . '))/u' ; $ matches = array ( ) ; preg_match_all ( $ pattern , $ isoFormat , $ matches ) ; ...
This method is not absolutely safe because of the volatile nature of the printf format . However it can validate a lot of strings as a first barrier for further code to be implemented .
3,250
public function setFixed ( $ fixed ) { if ( is_bool ( $ fixed ) ) { $ this -> fixed = $ fixed ; } else { $ msg = "Fixed must be a boolean, '" . gettype ( $ fixed ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set if the section part is subject to shuffling .
3,251
public function setLang ( $ lang = '' ) { if ( gettype ( $ lang ) === 'string' ) { $ this -> lang = $ lang ; } else { $ msg = "The lang argument must be a string, '" . gettype ( $ lang ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the language code .
3,252
public function setLabel ( $ label ) { if ( Format :: isString256 ( $ label ) === true ) { $ this -> label = $ label ; } else { $ msg = "The label argument must be a string with at most 256 characters." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the label of the item .
3,253
public function setAdaptive ( $ adaptive ) { if ( is_bool ( $ adaptive ) ) { $ this -> adaptive = $ adaptive ; } else { $ msg = "The adaptive argument must be a boolean, '" . gettype ( $ adaptive ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set whether the item is adaptive .
3,254
public function setToolName ( $ toolName ) { if ( Format :: isString256 ( $ toolName ) === true ) { $ this -> toolName = $ toolName ; } else { $ msg = "The toolName argument must be a string with at most 256 characters." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the name of the tool with which the item was created .
3,255
public function setToolVersion ( $ toolVersion ) { if ( Format :: isString256 ( $ toolVersion ) === true ) { $ this -> toolVersion = $ toolVersion ; } else { $ msg = "The toolVersion argument must be a string with at most 256 characters." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the version of the tool with which the item was created .
3,256
public function getEndAttemptIdentifiers ( ) { $ endAttemptIdentifiers = new IdentifierCollection ( ) ; foreach ( $ this -> getComponentsByClassName ( 'endAttemptInteraction' ) as $ endAttemptInteraction ) { $ endAttemptIdentifiers [ ] = $ endAttemptInteraction -> getResponseIdentifier ( ) ; } return $ endAttemptIdenti...
Get the response variable identifiers related to the endAttemptInteraction in the item content .
3,257
protected function unmarshallChildrenKnown ( DOMElement $ element , QtiComponentCollection $ children ) { $ object = new Substring ( $ children ) ; if ( ( $ caseSensitive = $ this -> getDOMElementAttributeAs ( $ element , 'caseSensitive' , 'boolean' ) ) !== null ) { $ object -> setCaseSensitive ( $ caseSensitive ) ; } ...
Unmarshall a QTI substring operator element into a Substring object .
3,258
protected function unmarshall ( DOMElement $ element ) { $ version = $ this -> getVersion ( ) ; if ( ( $ responseIdentifier = $ this -> getDOMElementAttributeAs ( $ element , 'responseIdentifier' ) ) !== null ) { $ objectElts = $ this -> getChildElementsByTagName ( $ element , 'object' ) ; if ( count ( $ objectElts ) >...
Unmarshall a DOMElement object corresponding to a selectPointInteraction element .
3,259
public function setHref ( $ href ) { if ( gettype ( $ href ) === 'string' ) { $ this -> href = $ href ; } else { $ msg = "href must be a string, '" . gettype ( $ href ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the URI that references the item s file .
3,260
protected function marshall ( QtiComponent $ component ) { $ element = self :: getDOMCradle ( ) -> createElement ( 'colgroup' ) ; $ this -> setDOMElementAttribute ( $ element , 'span' , $ component -> getSpan ( ) ) ; foreach ( $ component -> getContent ( ) as $ col ) { $ marshaller = $ this -> getMarshallerFactory ( ) ...
Marshall a Colgroup object into a DOMElement object .
3,261
protected function unmarshall ( DOMElement $ element ) { $ component = new Colgroup ( ) ; if ( ( $ span = $ this -> getDOMElementAttributeAs ( $ element , 'span' , 'integer' ) ) !== null ) { $ component -> setSpan ( $ span ) ; } $ cols = new ColCollection ( ) ; foreach ( $ this -> getChildElementsByTagName ( $ element ...
Unmarshall a DOMElement object corresponding to an XHTML colgroup table element .
3,262
protected function marshall ( QtiComponent $ component ) { $ element = static :: getDOMCradle ( ) -> createElement ( $ component -> getQtiClassName ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'responseIdentifier' , $ component -> getResponseIdentifier ( ) ) ; foreach ( $ component -> getShufflingGroups ( ) a...
Marshall a Shuffling object into a DOMElement object .
3,263
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> anythingButRecord ( ) === false ) { $ msg = "The Gcd operator only accepts operands with a cardinality of single, multiple or ordered." ; throw new OperatorProcessin...
Process the Gcd operator .
3,264
protected function marshall ( QtiComponent $ component ) { $ element = static :: getDOMCradle ( ) -> createElement ( $ component -> getQtiClassName ( ) ) ; foreach ( $ component -> getInterpolationTableEntries ( ) as $ interpolationTableEntry ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $...
Marshall an InterpolationTable object into a DOMElement object .
3,265
protected function unmarshall ( DOMElement $ element ) { $ interpolationTableEntryElements = $ element -> getElementsByTagName ( 'interpolationTableEntry' ) ; if ( $ interpolationTableEntryElements -> length > 0 ) { $ interpolationTableEntryCollection = new InterpolationTableEntryCollection ( ) ; for ( $ i = 0 ; $ i < ...
Unmarshall a DOMElement object corresponding to a QTI InterpolationTable element .
3,266
public function marshall ( $ data , $ output = Marshaller :: MARSHALL_JSON ) { if ( is_null ( $ data ) === true ) { $ json = array ( 'base' => $ data ) ; } elseif ( $ data instanceof State ) { $ json = array ( ) ; foreach ( $ data as $ variable ) { $ json [ $ variable -> getIdentifier ( ) ] = $ this -> marshallUnit ( $...
Marshall some QTI data into JSON .
3,267
protected function marshallUnit ( $ unit ) { if ( is_null ( $ unit ) === true ) { $ json = array ( 'base' => null ) ; } elseif ( $ unit instanceof QtiScalar ) { $ json = $ this -> marshallScalar ( $ unit ) ; } elseif ( $ unit instanceof MultipleContainer ) { $ json = array ( ) ; $ strBaseType = BaseType :: getNameByCon...
Marshall a single unit of QTI data .
3,268
protected function marshallComplex ( QtiDatatype $ complex ) { if ( $ complex instanceof QtiPoint ) { return $ this -> marshallPoint ( $ complex ) ; } elseif ( $ complex instanceof QtiDirectedPair ) { return $ this -> marshallDirectedPair ( $ complex ) ; } elseif ( $ complex instanceof QtiPair ) { return $ this -> mars...
Marshall a single complex QtiDataType object .
3,269
protected function marshallFile ( QtiFile $ file ) { $ data = array ( 'base' => array ( 'file' => array ( 'mime' => $ file -> getMimeType ( ) , 'data' => base64_encode ( $ file -> getData ( ) ) ) ) ) ; if ( $ file -> hasFilename ( ) === true ) { $ data [ 'base' ] [ 'file' ] [ 'name' ] = $ file -> getFilename ( ) ; } re...
Marshall a QTI file datatype into its PCI JSON Representation .
3,270
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The Subtract operator only accepts operands with a single cardinality" ; throw new OperatorProcessingException ( $ msg ,...
Process the Subtract operator .
3,271
protected function unmarshall ( DOMElement $ element ) { $ object = new Ordering ( ) ; if ( ( $ value = $ this -> getDOMElementAttributeAs ( $ element , 'shuffle' , 'boolean' ) ) !== null ) { $ object -> setShuffle ( $ value ) ; } return $ object ; }
Unmarshall a DOMElement object corresponding to a QTI Ordering element .
3,272
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The Inside operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( $ msg , ...
Process the Inside operator .
3,273
public function setTemplateIdentifier ( $ templateIdentifier ) { if ( Format :: isIdentifier ( $ templateIdentifier ) ) { $ this -> templateIdentifier = $ templateIdentifier ; } else { $ msg = "'${templateIdentifier}' is not a valid QTI Identifier." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the identifier of the template variable affected .
3,274
public function setAutostart ( $ autostart ) { if ( is_bool ( $ autostart ) === true ) { $ this -> autostart = $ autostart ; } else { $ msg = "The 'autostart' argument must be a boolean value, '" . gettype ( $ autostart ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set whether or not the media must start as soon as the candidate starts the attempt .
3,275
public function setMinPlays ( $ minPlays ) { if ( is_int ( $ minPlays ) === true && $ minPlays >= 0 ) { $ this -> minPlays = $ minPlays ; } else { $ msg = "The 'minPlays' argument must be a positive (>= 0) integer, '" . gettype ( $ minPlays ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the minimum number of times the media must be played .
3,276
public function setMaxPlays ( $ maxPlays ) { if ( is_int ( $ maxPlays ) && $ maxPlays >= 0 ) { $ this -> maxPlays = $ maxPlays ; } else { $ msg = "The 'maxPlays' argument must be a positive (>= 0) integer, '" . gettype ( $ maxPlays ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the maximum number of times the media can be played .
3,277
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The Power operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( $ msg , $...
Process the Power operator .
3,278
public function setNumberRepeats ( $ numberRepeats ) { if ( is_int ( $ numberRepeats ) || ( gettype ( $ numberRepeats ) === 'string' && Format :: isVariableRef ( $ numberRepeats ) ) ) { $ this -> numberRepeats = $ numberRepeats ; } else { $ msg = "The numberRepeats argument must be an integer or a variable reference, '...
Set the numberRepeats attribute .
3,279
protected function run ( ) { $ engine = $ this -> instantiateEngine ( ) ; $ arguments = $ this -> getArguments ( ) ; $ source = $ arguments [ 'source' ] ; $ doc = new XmlDocument ( ) ; $ validate = ! ( $ arguments [ 'novalidate' ] === true ) ; try { $ doc -> load ( $ source , $ validate ) ; $ renderingData = '' ; switc...
Renders a QTI XML File into another flavour .
3,280
private function runXhtml ( XmlDocument $ doc , XhtmlRenderingEngine $ renderer ) { $ arguments = $ this -> getArguments ( ) ; $ profile = $ arguments [ 'flavour' ] ; $ xml = $ renderer -> render ( $ doc -> getDocumentComponent ( ) ) ; $ header = '' ; $ footer = '' ; $ indent = '' ; $ nl = '' ; if ( $ arguments [ 'form...
Run the rendering behaviour related to the XHTML flavour .
3,281
private function instantiateEngine ( ) { $ arguments = $ this -> getArguments ( ) ; $ engine = null ; switch ( strtolower ( $ arguments [ 'flavour' ] ) ) { case 'goldilocks' : $ engine = new GoldilocksRenderingEngine ( ) ; break ; case 'xhtml' : $ engine = new XhtmlRenderingEngine ( ) ; break ; } if ( $ arguments [ 'xm...
Instantiate an appropriate Rendering Engine .
3,282
protected function unmarshall ( DOMElement $ element ) { if ( ( $ responseIdentifier = $ this -> getDOMElementAttributeAs ( $ element , 'responseIdentifier' ) ) !== null ) { $ component = new UploadInteraction ( $ responseIdentifier ) ; $ promptElts = $ this -> getChildElementsByTagName ( $ element , 'prompt' ) ; if ( ...
Unmarshall a DOMElement object corresponding to an uploadInteraction element .
3,283
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The DurationGTE operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( $ m...
Process the DurationGTE operator .
3,284
public function setRoundingMode ( $ roundingMode ) { if ( in_array ( $ roundingMode , RoundingMode :: asArray ( ) ) ) { $ this -> roundingMode = $ roundingMode ; } else { $ msg = "The roundingMode argument must be a value from the RoundingMode enumeration, '" . $ roundingMode . "' given." ; throw new InvalidArgumentExc...
Set the rounding mode .
3,285
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." ; throw new InvalidAr...
Set the number of figures to round to .
3,286
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 ( new D...
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 .
3,287
protected function resolveXmlBase ( ) { $ stack = $ this -> getXmlBaseStack ( ) ; $ stack -> rewind ( ) ; $ resolvedBase = '' ; while ( $ stack -> valid ( ) === true ) { if ( ( $ currentBase = $ stack -> current ( ) ) !== '' ) { if ( $ resolvedBase === '' ) { $ resolvedBase = $ currentBase ; } else { $ resolvedBase = U...
Resolve what is the base URL to be used for the currently explored component .
3,288
public function process ( ) { $ testSession = $ this -> getState ( ) ; $ itemSubset = $ this -> getItemSubset ( ) ; $ numberPresented = 0 ; foreach ( $ itemSubset as $ item ) { $ itemSessions = $ testSession -> getAssessmentItemSessions ( $ item -> getIdentifier ( ) ) ; if ( $ itemSessions !== false ) { foreach ( $ ite...
Process the related NumberPresented expression .
3,289
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 ) ; } }
Set whether a choice is required to be selected by the candidate .
3,290
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 ( $ msg ) ; } }
Set the InlineChoice objects composing the interaction .
3,291
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 ) ; } }
Set the src attribute .
3,292
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 ) ; } }
Set the alt attribute .
3,293
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." ; throw new InvalidArgumen...
Get the longdesc attribute .
3,294
protected function unmarshall ( DOMElement $ element ) { if ( ( $ responseIdentifier = $ this -> getDOMElementAttributeAs ( $ element , 'responseIdentifier' ) ) !== null ) { $ objectElts = $ this -> getChildElementsByTagName ( $ element , 'object' ) ; if ( count ( $ objectElts ) > 0 ) { $ object = $ this -> getMarshall...
Unmarshall a DOMElement object corresponding to a graphicGapMatchInteraction element .
3,295
protected function marshall ( QtiComponent $ component ) { $ element = $ this -> createElement ( $ component ) ; $ this -> fillElement ( $ element , $ component ) ; $ this -> setDOMElementAttribute ( $ element , 'responseIdentifier' , $ component -> getResponseIdentifier ( ) ) ; if ( $ component -> hasPrompt ( ) === tr...
Marshall an GraphicGapMatchInteraction object into a DOMElement object .
3,296
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 ) ; } }
Set wether or not the value is part of a record .
3,297
public function setFieldIdentifier ( $ fieldIdentifier ) { if ( $ fieldIdentifier == '' || Format :: isIdentifier ( $ fieldIdentifier ) ) { $ this -> fieldIdentifier = $ fieldIdentifier ; } else { $ msg = "'${fieldIdentifier}' is not a valid QTI identifier." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the field identifier . An empty string means it is not specified .
3,298
public static function asArray ( ) { return array ( 'DEF' => self :: DEF , 'RECT' => self :: RECT , 'CIRCLE' => self :: CIRCLE , 'POLY' => self :: POLY , 'ELLIPSE' => self :: ELLIPSE ) ; }
Get the enumeration as an array .
3,299
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 ) ; } }
Set the value of the Weight .