idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
3,100
protected function marshallIdentifier ( ) { $ identifier = $ this -> getToMarshall ( ) ; $ ctx = $ this -> getContext ( ) ; $ access = $ ctx -> getStreamAccess ( ) ; try { $ varName = $ ctx -> generateVariableName ( $ identifier ) ; $ access -> writeVariable ( $ varName ) ; $ access -> writeEquals ( $ ctx -> mustFormat...
Marshall an Identifier QTI datatype object .
3,101
protected function marshallPoint ( ) { $ point = $ this -> getToMarshall ( ) ; $ ctx = $ this -> getContext ( ) ; $ access = $ ctx -> getStreamAccess ( ) ; try { $ varName = $ ctx -> generateVariableName ( $ point ) ; $ access -> writeVariable ( $ varName ) ; $ access -> writeEquals ( $ ctx -> mustFormatOutput ( ) ) ; ...
Marshall a Point QTI datatype object .
3,102
public function setSelect ( $ select ) { if ( is_int ( $ select ) ) { $ this -> select = $ select ; } else { $ msg = "Select must be an integer, '" . gettype ( $ select ) . "' given." ; } }
Set the number of child elements to be selected .
3,103
public function setWithReplacement ( $ withReplacement ) { if ( is_bool ( $ withReplacement ) ) { $ this -> withReplacement = $ withReplacement ; } else { $ msg = "WithReplacement must be a boolean, '" . gettype ( $ withReplacement ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set if the selection of items must be with or without replacements .
3,104
public function setXmlString ( $ xmlString ) { $ this -> xmlString = $ xmlString ; if ( $ this -> externalComponent !== null ) { $ this -> getExternalComponent ( ) -> setXmlString ( $ xmlString ) ; } }
Set the xml string content of the selection itself and its content .
3,105
protected function marshall ( QtiComponent $ component ) { $ element = static :: getDOMCradle ( ) -> createElement ( $ component -> getQtiClassName ( ) ) ; $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ component -> getExpression ( ) ) ; $ element -> appendChild ( $ marshaller -> marshall ( $...
Marshall a PreCondition object into a DOMElement object .
3,106
protected function unmarshall ( DOMElement $ element ) { $ expressionElt = self :: getFirstChildElement ( $ element ) ; if ( $ expressionElt !== false ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ expressionElt ) ; $ object = new PreCondition ( $ marshaller -> unmarshall ( $ expressionEl...
Unmarshall a DOMElement object corresponding to a QTI preCondition element .
3,107
protected function unmarshall ( DOMElement $ element ) { $ matchTableEntryElements = $ element -> getElementsByTagName ( 'matchTableEntry' ) ; if ( $ matchTableEntryElements -> length > 0 ) { $ matchTableEntries = new MatchTableEntryCollection ( ) ; for ( $ i = 0 ; $ i < $ matchTableEntryElements -> length ; $ i ++ ) {...
Unmarshall a DOMElement object corresponding to a QTI MatchTable element .
3,108
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } elseif ( $ operands -> anythingButRecord ( ) === false ) { $ msg = "The Product operator only accepts operands with a single, multiple or ordered cardinality." ; throw new OperatorProc...
Process the Product operator .
3,109
public function setComponent ( QtiComponent $ printedVariable ) { if ( $ printedVariable instanceof PrintedVariable ) { parent :: setComponent ( $ printedVariable ) ; } else { $ msg = "The PrintedVariableEngine class only accepts PrintedVariable objects to be executed." ; throw new InvalidArgumentException ( $ msg ) ; ...
Set the PrintedVariable object to be executed by the engine depending on the current context .
3,110
public function process ( ) { $ printedVariable = $ this -> getComponent ( ) ; $ identifier = $ printedVariable -> getIdentifier ( ) ; $ state = $ this -> getContext ( ) ; if ( $ state [ $ identifier ] === null ) { return '' ; } $ variable = $ state -> getVariable ( $ identifier ) ; $ value = $ variable -> getValue ( )...
Processes the encapsulated PrintedVariable object into a formatted string depending on the PrintedVariable object and the current context .
3,111
private function processRecord ( Variable $ variable ) { $ processedValues = array ( ) ; $ baseType = $ variable -> getBaseType ( ) ; $ mappingIndicator = $ this -> getComponent ( ) -> getMappingIndicator ( ) ; foreach ( $ variable -> getValue ( ) as $ k => $ v ) { $ processedValues [ ] = "${k}${mappingIndicator}" . $ ...
Processes all values of a record container and merge them into a single string .
3,112
public function setOutcomeIdentifier ( $ outcomeIdentifier ) { if ( Format :: isIdentifier ( $ outcomeIdentifier ) ) { $ this -> outcomeIdentifier = $ outcomeIdentifier ; } else { $ msg = "'${outcomeIdentifier}' is not a valid QTI Identifier." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the outcome identifier .
3,113
protected function marshall ( QtiComponent $ component ) { $ element = $ this -> createElement ( $ component ) ; $ arrayViews = array ( ) ; foreach ( $ component -> getViews ( ) as $ view ) { $ key = array_search ( $ view , View :: asArray ( ) ) ; $ arrayViews [ ] = strtolower ( str_replace ( "\xf2" , "\x20" , $ key ) ...
Marshall a RubricBlock object into a DOMElement object .
3,114
protected function unmarshall ( DOMElement $ element ) { if ( ( $ value = $ this -> getDOMElementAttributeAs ( $ element , 'view' , 'string' ) ) !== null ) { $ viewsArray = explode ( "\x20" , $ value ) ; $ viewsCollection = new ViewCollection ( ) ; $ ref = View :: asArray ( ) ; foreach ( $ viewsArray as $ viewString ) ...
Unmarshall a DOMElement object corresponding to a QTI rubrickBlock element .
3,115
public function generateVariableName ( $ value ) { $ occurence = 0 ; if ( is_object ( $ value ) === true ) { $ counter = $ this -> getObjectCount ( ) ; $ className = get_class ( $ value ) ; if ( isset ( $ counter [ $ className ] ) === false ) { $ occurence = 0 ; $ counter [ $ className ] = $ occurence ; } else { $ occu...
Generates a suitable variable name to be used for a given value .
3,116
protected function marshall ( QtiComponent $ component ) { $ element = static :: getDOMCradle ( ) -> createElement ( $ component -> getQtiClassName ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'identifiers' , implode ( "\x20" , $ component -> getIdentifiers ( ) -> getArrayCopy ( ) ) ) ; $ fixedIdentifiers = $...
Marshall a ShufflingGroup object into a DOMElement object .
3,117
public static function createFromDataModel ( ValueCollection $ valueCollection , $ baseType = BaseType :: INTEGER ) { $ container = new static ( $ baseType ) ; foreach ( $ valueCollection as $ value ) { $ container [ ] = RuntimeUtils :: valueToRuntime ( $ value -> getValue ( ) , $ value -> getBaseType ( ) ) ; } return ...
Create a MultipleContainer object from a Data Model ValueCollection object .
3,118
protected function marshall ( QtiComponent $ component ) { $ element = static :: getDOMCradle ( ) -> createElement ( $ component -> getQtiClassName ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'sourceIdentifier' , $ component -> getSource ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'targetIdentifie...
Marshall a VariableMapping object into a DOMElement object .
3,119
protected function unmarshall ( DOMElement $ element ) { if ( ( $ source = $ this -> getDOMElementAttributeAs ( $ element , 'sourceIdentifier' , 'string' ) ) !== null ) { if ( ( $ target = $ this -> getDOMElementAttributeAs ( $ element , 'targetIdentifier' , 'string' ) ) !== null ) { try { $ object = new VariableMappin...
Unmarshall a DOMElement object corresponding to a QTI variableMapping element .
3,120
public function setToMarshall ( $ toMarshall ) { if ( $ this -> isMarshallable ( $ toMarshall ) === false ) { $ msg = "The value to marshall cannot be managed by this implementation." ; throw new InvalidArgumentException ( $ msg ) ; } $ this -> toMarshall = $ toMarshall ; }
Set the value that has to be marshalled .
3,121
public function marshall ( QtiComponent $ component ) { $ element = self :: getDOMCradle ( ) -> createElement ( 'rubricBlockRef' ) ; $ this -> setDOMElementAttribute ( $ element , 'identifier' , $ component -> getIdentifier ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'href' , $ component -> getHref ( ) ) ; r...
Marshall a RubricBlockRef object to its XML counterpart .
3,122
public function unmarshall ( DOMElement $ element ) { if ( ( $ identifier = $ this -> getDOMElementAttributeAs ( $ element , 'identifier' ) ) !== null ) { if ( ( $ href = $ this -> getDOMElementAttributeAs ( $ element , 'href' ) ) !== null ) { return new RubricBlockRef ( $ identifier , $ href ) ; } else { $ msg = "The ...
Unmarshall a DOMElement to its RubricBlockRef data model representation .
3,123
public function getGetters ( $ excludeConstructor = false ) { $ methods = new BeanMethodCollection ( ) ; foreach ( $ this -> getProperties ( ) as $ prop ) { if ( ( $ getterName = $ this -> hasGetter ( $ prop -> getName ( ) ) ) !== false ) { if ( $ excludeConstructor === false || $ this -> hasConstructorParameter ( $ pr...
Get the valid bean getters of the bean .
3,124
public function getSetters ( $ excludeConstructor = false ) { $ methods = new BeanMethodCollection ( ) ; foreach ( $ this -> getProperties ( ) as $ prop ) { if ( $ this -> hasSetter ( $ prop -> getName ( ) ) === true ) { if ( $ excludeConstructor === false || $ this -> hasConstructorParameter ( $ prop -> getName ( ) ) ...
Get the valid setters of this bean .
3,125
public function getProperties ( ) { $ properties = new BeanPropertyCollection ( ) ; $ registeredProperties = array ( ) ; $ target = $ this -> getClass ( ) ; while ( $ target ) { foreach ( $ target -> getProperties ( ) as $ prop ) { $ propName = $ prop -> getName ( ) ; if ( $ this -> isPropertyAnnotated ( $ propName ) =...
Get the bean properties . Only valid annotated bean properties will be returned .
3,126
public function getConstructorGetters ( ) { $ getters = new BeanMethodCollection ( ) ; foreach ( $ this -> getConstructorParameters ( ) as $ param ) { $ getters [ ] = $ this -> getGetter ( $ param -> getName ( ) ) ; } return $ getters ; }
Get the bean getters related to the parameters of the bean s constructor .
3,127
public function getConstructorSetters ( ) { $ setters = new BeanMethodCollection ( ) ; foreach ( $ this -> getConstructorParameters ( ) as $ param ) { $ setters [ ] = $ this -> getSetter ( $ param -> getName ( ) ) ; } return $ setters ; }
Get the bean setters related to the parameters of the bean s constructor .
3,128
public function getConstructorParameters ( ) { $ parameters = new BeanParameterCollection ( ) ; if ( ( $ ctor = $ this -> getClass ( ) -> getConstructor ( ) ) !== null ) { foreach ( $ ctor -> getParameters ( ) as $ param ) { if ( $ this -> hasProperty ( $ param -> getName ( ) ) === true ) { $ parameters [ ] = new BeanP...
Get the constructor parameters of the bean . Only parameters that have the same name than a valid bean property will be returned .
3,129
protected function isPropertyAnnotated ( $ propertyName ) { $ target = $ this -> getClass ( ) ; $ isAnnotated = false ; while ( $ target ) { if ( $ target -> hasProperty ( $ propertyName ) ) { $ comment = $ target -> getProperty ( $ propertyName ) -> getDocComment ( ) ; if ( empty ( $ comment ) === false ) { $ isAnnota...
Whether a given property is annotated with the appropriate bean annotation .
3,130
protected function validateStrictBean ( ) { if ( $ this -> getClass ( ) -> hasMethod ( '__construct' ) === true ) { $ params = $ this -> getClass ( ) -> getMethod ( '__construct' ) -> getParameters ( ) ; $ class = $ this -> getClass ( ) -> getName ( ) ; foreach ( $ params as $ param ) { $ name = $ param -> getName ( ) ...
Contains the internal logic of bean validation . Throws exceptions to know why it s not a valid bean .
3,131
public function setFirst ( $ first ) { if ( Format :: isIdentifier ( $ first ) ) { $ this -> first = $ first ; } else { $ msg = "'${first}' is an invalid QTI identifier." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the first identifier of the pair .
3,132
public function setSecond ( $ second ) { if ( Format :: isIdentifier ( $ second ) ) { $ this -> second = $ second ; } else { $ msg = "'${second}' is an invalid QTI identifier." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the second identifier of the pair .
3,133
public function createFromFile ( $ path , $ mimeType , $ filename = '' ) { $ destination = $ this -> buildDestination ( ) ; try { return FileSystemFile :: createFromExistingFile ( $ path , $ destination , $ mimeType , $ filename ) ; } catch ( RuntimeException $ e ) { $ msg = "An error occured while creating a QTI FileS...
Create a FileSystemFile object from an existing file on the file system .
3,134
public function createFromData ( $ data , $ mimeType , $ filename = '' ) { $ destination = $ this -> buildDestination ( ) ; try { return FileSystemFile :: createFromData ( $ data , $ destination , $ mimeType , $ filename ) ; } catch ( RuntimeException $ e ) { $ msg = "An error occured while creating a QTI FileSystemFil...
Create a FileSystemFile from existing data on the file system .
3,135
public function retrieve ( $ identifier ) { try { return FileSystemFile :: retrieveFile ( $ identifier ) ; } catch ( RuntimeException $ e ) { $ msg = "An error occured while retrieving a QTI FileSystemFile object." ; throw new FileManagerException ( $ msg , 0 , $ e ) ; } }
Retrieve a FileSystemFile object from its unique identifier .
3,136
public function delete ( QtiFile $ file ) { $ deletion = @ unlink ( $ file -> getPath ( ) ) ; if ( $ deletion === false ) { $ msg = "The File System File located at '" . $ file -> getPath ( ) . "' could not be deleted gracefully." ; throw new FileManagerException ( $ msg ) ; } }
Delete a FileSystemFile object from the persistence .
3,137
public function setName ( $ name ) { if ( in_array ( $ name , MathEnumeration :: asArray ( ) ) ) { $ this -> name = $ name ; } else { $ msg = "${name} is not a valid QTI Math constant." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the name of the math constant .
3,138
public function setInterpolationTableEntries ( InterpolationTableEntryCollection $ interpolationTableEntries ) { if ( count ( $ interpolationTableEntries ) > 0 ) { $ this -> interpolationTableEntries = $ interpolationTableEntries ; } else { $ msg = "An InterpolationTable object must contain at least one InterpolationTa...
Set the InterpolationTableEntry objects contained by the current InterpolationTable .
3,139
public static function getConstantByName ( $ name ) { switch ( trim ( strtolower ( $ name ) ) ) { case 'identifier' : return self :: IDENTIFIER ; break ; case 'boolean' : return self :: BOOLEAN ; break ; case 'integer' : return self :: INTEGER ; break ; case 'float' : return self :: FLOAT ; break ; case 'string' : retu...
Get a constant value from the BaseType enumeration by baseType name .
3,140
public static function getNameByConstant ( $ constant ) { switch ( $ constant ) { case self :: IDENTIFIER : return 'identifier' ; break ; case self :: BOOLEAN : return 'boolean' ; break ; case self :: INTEGER : return 'integer' ; break ; case self :: FLOAT : return 'float' ; break ; case self :: STRING : return 'string...
Get the QTI name of a BaseType .
3,141
protected function setProperty ( ReflectionProperty $ property ) { if ( mb_strpos ( $ property -> getDocComment ( ) , Bean :: ANNOTATION_PROPERTY , 0 , 'UTF-8' ) !== false ) { $ this -> property = $ property ; } else { $ msg = "The property must be annotated with '@qtism-bean-property'." ; throw new BeanException ( $ m...
Set the wrapped ReflectionProperty object .
3,142
public function marshall ( QtiComponent $ component ) { $ element = self :: getDOMCradle ( ) -> createElement ( 'responseValidityConstraint' ) ; $ this -> setDOMElementAttribute ( $ element , 'responseIdentifier' , $ component -> getResponseIdentifier ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'minConstrain...
Marshall a ResponseValidityConstraint object to its XML counterpart .
3,143
public function unmarshall ( DOMElement $ element ) { if ( ( $ responseIdentifier = $ this -> getDOMElementAttributeAs ( $ element , 'responseIdentifier' ) ) !== null ) { if ( ( $ minConstraint = $ this -> getDOMElementAttributeAs ( $ element , 'minConstraint' , 'integer' ) ) !== null ) { if ( ( $ maxConstraint = $ thi...
Unmarshall a DOMElement to its ResponseValidityConstraint data model representation .
3,144
protected function unmarshallUnit ( array $ unit ) { if ( isset ( $ unit [ 'base' ] ) ) { try { $ keys = array_keys ( $ unit [ 'base' ] ) ; switch ( $ keys [ 0 ] ) { case 'boolean' : return $ this -> unmarshallBoolean ( $ unit ) ; break ; case 'integer' : return $ this -> unmarshallInteger ( $ unit ) ; break ; case 'fl...
Unmarshall a unit of data into QTISM runtime model .
3,145
protected function unmarshallFloat ( array $ unit ) { $ val = $ unit [ 'base' ] [ 'float' ] ; if ( is_int ( $ val ) === true ) { $ val = floatval ( $ val ) ; } return new QtiFloat ( $ val ) ; }
Unmarshall a float JSON PCI representation .
3,146
protected function unmarshallFile ( array $ unit ) { $ filename = ( empty ( $ unit [ 'base' ] [ 'file' ] [ 'name' ] ) === true ) ? '' : $ unit [ 'base' ] [ 'file' ] [ 'name' ] ; return $ this -> getFileManager ( ) -> createFromData ( base64_decode ( $ unit [ 'base' ] [ 'file' ] [ 'data' ] ) , $ unit [ 'base' ] [ 'file'...
Unmarshall a duration JSON PCI representation .
3,147
protected function unmarshallChildrenKnown ( DOMElement $ element , QtiComponentCollection $ children ) { if ( ( $ pattern = $ this -> getDOMElementAttributeAs ( $ element , 'pattern' ) ) !== null ) { $ object = new PatternMatch ( $ children , $ pattern ) ; return $ object ; } else { $ msg = "The mandatory attribute 'p...
Unmarshall a QTI patternMatch operator element into an PatternMatch object .
3,148
public function setData ( $ data ) { if ( ( is_string ( $ data ) === true && $ data === '' ) || Format :: isUri ( $ data ) === true ) { $ this -> data = $ data ; } else { $ msg = "The 'data' argument must be a URI or an empty string, '" . gettype ( $ data ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; ...
Set the URI for locating the data of the object .
3,149
public function setWidth ( $ width ) { if ( is_int ( $ width ) === true ) { $ this -> width = $ width ; } else { $ msg = "The 'width' argument must be an integer, '" . gettype ( $ width ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the width of the object .
3,150
public function setHeight ( $ height ) { if ( is_int ( $ height ) === true ) { $ this -> height = $ height ; } else { $ msg = "The 'height' argument must be an integer, '" . gettype ( $ height ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the height of the object .
3,151
public function marshall ( QtiComponent $ component ) { $ element = self :: getDOMCradle ( ) -> createElement ( 'modalFeedbackRule' ) ; $ this -> setDOMElementAttribute ( $ element , 'outcomeIdentifier' , $ component -> getOutcomeIdentifier ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'showHide' , ShowHide ::...
Marshall a ModalFeedbackRule object to its XML counterpart .
3,152
public function unmarshall ( DOMElement $ element ) { if ( ( $ identifier = $ this -> getDOMElementAttributeAs ( $ element , 'identifier' ) ) !== null ) { if ( ( $ outcomeIdentifier = $ this -> getDOMElementAttributeAs ( $ element , 'outcomeIdentifier' ) ) !== null ) { if ( ( $ showHide = $ this -> getDOMElementAttribu...
Unmarshall a DOMElement to its ModalFeedbackRule data model representation .
3,153
public function setMappedValue ( $ mappedValue ) { if ( is_float ( $ mappedValue ) || is_double ( $ mappedValue ) ) { $ this -> mappedValue = $ mappedValue ; } else { $ msg = "The attribute 'mappedValue' must be a float value, '" . gettype ( $ mappedValue ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; ...
Set the mapped value .
3,154
public function setCaseSensitive ( $ caseSensitive ) { if ( is_bool ( $ caseSensitive ) ) { $ this -> caseSensitive = $ caseSensitive ; } else { $ msg = "The attribute 'caseSensitive' must be a boolean value, '" . gettype ( $ caseSensitive ) . "'." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set whether the mapEntry string is matched case sensitively .
3,155
public function setMaxChoices ( $ maxChoices ) { if ( is_int ( $ maxChoices ) === true && $ maxChoices >= 0 ) { $ this -> maxChoices = $ maxChoices ; } else { $ msg = "The 'maxChoices' argument must be a positive (>= 0) integer, '" . gettype ( $ maxChoices ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ;...
Set the maximum number of points that the candidate is allowed to select .
3,156
protected function marshall ( QtiComponent $ component ) { $ element = self :: getDOMCradle ( ) -> createElement ( 'templateProcessing' ) ; foreach ( $ component -> getTemplateRules ( ) as $ templateRule ) { $ element -> appendChild ( $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ templateRule ) -> marshall...
Marshall a TemplateProcessing object into a DOMElement object .
3,157
protected function unmarshall ( DOMElement $ element ) { $ childrenTagNames = array ( 'exitTemplate' , 'setCorrectResponse' , 'setDefaultValue' , 'setTemplateValue' , 'templateCondition' , 'templateConstraint' ) ; $ templateRuleElts = $ this -> getChildElementsByTagName ( $ element , $ childrenTagNames ) ; $ templateRu...
Unmarshall a DOMElement object corresponding to a QTI templateProcessing element .
3,158
public function setName ( $ name ) { if ( in_array ( $ name , MathFunctions :: asArray ( ) ) ) { $ this -> name = $ name ; } else { $ msg = "The name attribute must be a value from the MathFunctions enumeration, '" . $ name . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the name of the math function to use .
3,159
public function setMasteryValue ( $ masteryValue ) { if ( ( is_bool ( $ masteryValue ) && $ masteryValue === false ) || is_float ( $ masteryValue ) || is_double ( $ masteryValue ) ) { $ this -> masteryValue = $ masteryValue ; } else { $ msg = "The masteryValue argument must be a floating point value or false, '" . gett...
Set the mastery value .
3,160
public static function createFromDataModel ( VariableDeclaration $ variableDeclaration ) { $ variable = parent :: createFromDataModel ( $ variableDeclaration ) ; if ( $ variableDeclaration instanceof OutcomeDeclaration ) { $ variable -> setViews ( $ variableDeclaration -> getViews ( ) ) ; $ variable -> setNormalMaximum...
Create an OutcomeVariable object from a data model VariableDeclaration object .
3,161
public function applyDefaultValue ( ) { parent :: applyDefaultValue ( ) ; if ( is_null ( $ this -> getDefaultValue ( ) ) === true && $ this -> getCardinality ( ) === Cardinality :: SINGLE ) { if ( $ this -> getBaseType ( ) === BaseType :: INTEGER ) { $ this -> setValue ( new QtiInteger ( 0 ) ) ; } elseif ( $ this -> ge...
Apply the default value to the OutcomeVariable .
3,162
public function setMinChoices ( $ minChoices ) { if ( is_int ( $ minChoices ) && $ minChoices >= 0 ) { if ( ( $ maxChoices = $ this -> getMaxChoices ( ) ) > 0 && $ minChoices > $ maxChoices ) { $ msg = "The 'minChoices' argument must be less than or equal to the limits imposed by 'maxChoices'." ; throw new InvalidArgum...
Set the minimum number of positions that the image must be placed to form a valid response to the interaction .
3,163
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelySingle ( ) === false ) { $ msg = "The Substring operator only accepts operands with a single cardinality." ; throw new OperatorProcessingException ( $ msg...
Process the Substring operator .
3,164
protected function getItemSubset ( ) { $ sectionIdentifier = $ this -> getSectionIdentifier ( ) ; $ includeCategories = $ this -> getIncludeCategories ( ) ; $ excludeCategories = $ this -> getExcludeCategories ( ) ; return $ this -> getState ( ) -> getItemSubset ( $ sectionIdentifier , $ includeCategories , $ excludeCa...
A convenience method enabling you to get the item subset corresponding to the ItemSubset expression to be processed .
3,165
public function setMin ( $ min ) { if ( is_numeric ( $ min ) || Format :: isVariableRef ( $ min ) ) { $ this -> min = $ min ; } else { $ msg = "'Min' must be a numeric value or a variableRef, '" . gettype ( $ min ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the min attribute value .
3,166
public function setMax ( $ max ) { if ( is_numeric ( $ max ) || Format :: isVariableRef ( $ max ) ) { $ this -> max = $ max ; } else { $ msg = "'Max must be a numeric value or a variableRef, '" . gettype ( $ max ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the max attribute .
3,167
public function setDefinition ( $ definition ) { if ( is_string ( $ definition ) === true ) { $ this -> definition = $ definition ; } else { $ msg = "The 'definition' argument must be a string, '" . gettype ( $ class ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the URI that identifies the definition of the custom operator in the global namespace . An empty value means there is no value set for the definition attribute .
3,168
public function setIdentifier ( $ identifier ) { if ( is_string ( $ identifier ) === false || empty ( $ identifier ) === true ) { throw new InvalidArgumentException ( "The 'identifier' argument must be a non-empty string." ) ; } $ this -> identifier = $ identifier ; }
Set the identifier on which the validity constraint applies to .
3,169
protected function marshall ( QtiComponent $ component ) { $ element = static :: getDOMCradle ( ) -> createElement ( $ component -> getQtiClassName ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'sourceValue' , $ component -> getSourceValue ( ) ) ; $ this -> setDOMElementAttribute ( $ element , 'targetValue' , ...
Marshall a MatchTableEntry object into a DOMElement object .
3,170
protected function unmarshall ( DOMElement $ element ) { if ( ( $ sourceValue = $ this -> getDOMElementAttributeAs ( $ element , 'sourceValue' , 'integer' ) ) !== null ) { if ( ( $ targetValue = $ this -> getDOMElementAttributeAs ( $ element , 'targetValue' , 'string' ) ) !== null ) { $ object = new MatchTableEntry ( $...
Unmarshall a DOMElement object corresponding to a QTI MatchTableEntry element .
3,171
static public function lastPregErrorMessage ( ) { $ error = preg_last_error ( ) ; $ errorType = 'PCRE Engine error' ; switch ( $ error ) { case PREG_BACKTRACK_LIMIT_ERROR : $ errorType = "PCRE Engine backtrack limit exceeded" ; break ; case PREG_RECURSION_LIMIT_ERROR : $ errorType = "PCRE Engine recursion limit exceede...
Get a meaningful message for the last PREG error that occured .
3,172
static public function prepareXsdPatternForPcre ( $ pattern ) { $ pattern = self :: escapeSymbols ( $ pattern , array ( '$' , '^' ) ) ; $ pattern = self :: pregAddDelimiter ( '^' . $ pattern . '$' ) ; $ pattern .= 's' ; return $ pattern ; }
Prepare an XSD Regular Expression pattern into a PCRE compliant one .
3,173
public static function main ( ) { $ cli = new static ( ) ; $ arguments = $ cli -> setupArguments ( ) ; $ arguments -> addFlag ( array ( 'help' , 'h' ) , 'Show help screen.' ) ; $ arguments -> addFlag ( array ( 'verbose' , 'v' ) , 'Verbose mode.' ) ; $ arguments -> parse ( ) ; $ cli -> setArguments ( $ arguments ) ; if ...
Main CLI entry point .
3,174
protected function success ( $ message ) { if ( $ this -> isVerbose ( ) === true ) { $ this -> out ( "%g${message}%n" , true ) ; } exit ( self :: EXIT_SUCCESS ) ; }
Show a success message as a single line in stdout and return a zero POSIX exit status .
3,175
protected function out ( $ data , $ newLine = true ) { CliTools \ out ( $ data ) ; if ( $ newLine === true ) { CliTools \ out ( "\n" ) ; } }
Show raw data in console even if verbose mode is not in force .
3,176
public function getArrayCopy ( $ preserveKeys = false ) { return ( $ preserveKeys === true ) ? $ this -> dataPlaceHolder : array_values ( $ this -> dataPlaceHolder ) ; }
Get a copy of the collection as an array . This method is implemented in order to implement ArrayObject in a near future .
3,177
public function merge ( AbstractCollection $ collection ) { if ( is_subclass_of ( $ collection , get_class ( $ this ) ) === true || get_class ( $ collection ) === get_class ( $ this ) ) { $ newData = array_merge ( $ this -> dataPlaceHolder , $ collection -> getDataPlaceHolder ( ) ) ; $ this -> dataPlaceHolder = $ newDa...
Merge the collection with another one .
3,178
public function diff ( AbstractCollection $ collection ) { if ( get_class ( $ this ) === get_class ( $ collection ) ) { $ newData = array_diff ( $ this -> dataPlaceHolder , $ collection -> getDataPlaceHolder ( ) ) ; return new static ( $ newData ) ; } else { $ msg = "Difference may apply only on two collections of the ...
Get the difference between this collection and another one .
3,179
public function intersect ( AbstractCollection $ collection ) { if ( get_class ( $ this ) === get_class ( $ collection ) ) { $ newData = array_intersect ( $ this -> dataPlaceHolder , $ collection -> getDataPlaceHolder ( ) ) ; return new static ( $ newData ) ; } else { $ msg = "Intersection may apply only on two collect...
Get the intersection between this collection and another one .
3,180
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> sameBaseType ( ) === false ) { $ msg = "The Member operator only accepts values with the same baseType." ; throw new OperatorProcessingException ( $ msg , $ this , O...
Process the Member operator .
3,181
public function setSimpleMatchSets ( SimpleMatchSetCollection $ simpleMatchSets ) { if ( count ( $ simpleMatchSets ) === 2 ) { $ this -> simpleMatchSets = $ simpleMatchSets ; } else { $ msg = "A MatchInteraction object must be composed of exactly two SimpleMatchSet objects." ; throw new InvalidArgumentException ( $ msg...
Set the set of choices . The first defines the source choices and the second one the targets .
3,182
public function setBasePath ( $ basePath = '' ) { if ( gettype ( $ basePath ) === 'string' ) { $ this -> basePath = $ basePath ; } else { $ msg = "The basePath argument must be a valid string, '" . gettype ( $ basePath ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the basePath .
3,183
public function setSourceValue ( $ sourceValue ) { if ( is_int ( $ sourceValue ) ) { $ this -> sourceValue = $ sourceValue ; } else { $ msg = "SourceValue must be an integer, '" . gettype ( $ sourceValue ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the source integer that must be matched exactly .
3,184
public function setTemplateIdentifier ( $ templateIdentifier ) { if ( Format :: isIdentifier ( $ templateIdentifier , false ) === true ) { $ this -> templateIdentifier = $ templateIdentifier ; } else { $ msg = "The 'templateIdentifier' argument must be a valid QTI identifier, '" . $ templateIdentifier . "' given." ; th...
Set the template variable identifier .
3,185
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) ) { return null ; } if ( $ operands -> exclusivelyOrdered ( ) === false ) { $ msg = "The Index operator only accepts values with a cardinality of ordered." ; throw new OperatorProcessingException ( $ msg , $ this ...
Process the Index operator .
3,186
public function setName ( $ name ) { if ( is_string ( $ name ) === false ) { $ msg = "The 'name' argument must be a string value, '" . gettype ( $ name ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } $ this -> name = $ name ; }
Set the name of the variable .
3,187
public function setTitle ( $ title ) { if ( is_string ( $ title ) === true ) { $ this -> title = $ title ; } else { $ msg = "The 'title' argument must be a string, '" . gettype ( $ title ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the title of the feedback .
3,188
protected function marshall ( QtiComponent $ component ) { $ element = self :: getDOMCradle ( ) -> createElement ( 'col' ) ; if ( $ component -> getSpan ( ) !== 1 ) { $ this -> setDOMElementAttribute ( $ element , 'span' , $ component -> getSpan ( ) ) ; } $ this -> fillElement ( $ element , $ component ) ; return $ ele...
Marshall a Col object into a DOMElement object .
3,189
protected function unmarshall ( DOMElement $ element ) { $ component = new Col ( ) ; if ( ( $ span = $ this -> getDOMElementAttributeAs ( $ element , 'span' , 'integer' ) ) !== null ) { $ component -> setSpan ( $ span ) ; } $ this -> fillBodyElement ( $ component , $ element ) ; return $ component ; }
Unmarshall a DOMElement object corresponding to an XHTML col element .
3,190
public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelyMultipleOrOrdered ( ) === false ) { $ msg = "The StatsOperator operator only accepts operands with a multiple or ordered cardinality." ; throw new Operato...
Process the StatsOperator .
3,191
static public function compare ( $ version1 , $ version2 , $ operator = null ) { $ version1 = trim ( $ version1 ) ; $ version2 = trim ( $ version2 ) ; $ version1 = self :: appendPatchVersion ( $ version1 ) ; $ version2 = self :: appendPatchVersion ( $ version2 ) ; $ knownVersions = self :: knownVersions ( ) ; if ( self...
Compare two version numbers of QTI following the rules of Semantic Versioning .
3,192
public function setTitle ( $ title ) { if ( gettype ( $ title ) === 'string' ) { $ this -> title = $ title ; } else { $ msg = "Title must be a string, '" . gettype ( $ title ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the title of the Assessment Section .
3,193
public function setVisible ( $ visible ) { if ( is_bool ( $ visible ) ) { $ this -> visible = $ visible ; } else { $ msg = "Visible must be a boolean, '" . gettype ( $ visible ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set the visibility of the section .
3,194
public function setKeepTogether ( $ keepTogether ) { if ( is_bool ( $ keepTogether ) ) { $ this -> keepTogether = $ keepTogether ; } else { $ msg = "KeepTogether must be a boolean, '" . gettype ( $ keepTogether ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } }
Set if the items must be kept together if the section is invisible .
3,195
static public function templateProcessingImpactedVariables ( TemplateProcessing $ templateProcessing ) { $ identifiers = array ( ) ; $ classNames = array ( 'setTemplateValue' , 'setCorrectResponse' , 'setDefaultValue' ) ; $ iterator = $ templateProcessing -> getComponentsByClassName ( $ classNames ) ; foreach ( $ itera...
Obtain a list of the identifiers of variables that might have their values changed by a templateProcessing description .
3,196
protected function unmarshallChildrenKnown ( DOMElement $ element , QtiComponentCollection $ children ) { if ( ( $ numberRepeats = $ this -> getDOMElementAttributeAs ( $ element , 'numberRepeats' ) ) !== null ) { if ( Format :: isInteger ( $ numberRepeats ) ) { $ numberRepeats = intval ( $ numberRepeats ) ; } $ object ...
Unmarshall a QTI repeat operator element into a Repeat object .
3,197
protected function marshall ( QtiComponent $ component ) { $ element = self :: getDOMCradle ( ) -> createElement ( $ component -> getQtiClassName ( ) ) ; foreach ( $ component -> getOutcomeRules ( ) as $ outcomeRule ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ outcomeRule ) ; $ element ...
Marshall an OutcomeProcessing object into a DOMElement object .
3,198
protected function unmarshall ( DOMElement $ element ) { $ outcomeRuleElts = self :: getChildElements ( $ element ) ; $ outcomeRules = new OutcomeRuleCollection ( ) ; for ( $ i = 0 ; $ i < count ( $ outcomeRuleElts ) ; $ i ++ ) { $ marshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ outcomeRuleElts ...
Unmarshall a DOMElement object corresponding to a QTI outcomeProcessing element .
3,199
public function render ( $ file , $ id = '' ) { if ( empty ( $ id ) === true ) { $ id = uniqid ( ) ; } $ this -> init ( $ id , $ file ) ; $ stream = $ this -> getStream ( ) ; while ( $ stream -> eof ( ) === false ) { try { $ char = $ stream -> read ( 1 ) ; $ this -> beforeCharReading ( $ char ) ; switch ( $ this -> get...
Rescope the content of a given CSS file .