You are here

private function FillInProcessor::determineCaseMatters in Opigno module 3.x

Same name and namespace in other branches
  1. 8 ActivityTypes/opigno_h5p/src/TypeProcessors/FillInProcessor.php \Drupal\opigno_h5p\TypeProcessors\FillInProcessor::determineCaseMatters()

Determine if interaction answer is case sensitive.

Parameters

string $singleCRP: A correct responses pattern with encoded option.

Return value

array Case sensitivity data.

1 call to FillInProcessor::determineCaseMatters()
FillInProcessor::generateHTML in ActivityTypes/opigno_h5p/src/TypeProcessors/FillInProcessor.php
Options for interaction and generates a human readable HTML report.

File

ActivityTypes/opigno_h5p/src/TypeProcessors/FillInProcessor.php, line 159

Class

FillInProcessor
Class FillInProcessor.

Namespace

Drupal\opigno_h5p\TypeProcessors

Code

private function determineCaseMatters($singleCRP) {
  $html = '';
  $nextIndex = 0;
  $caseSensitive = NULL;

  // Check if interaction has case sensitivity option as first option.
  if (strtolower(substr($singleCRP, 1, 13)) === 'case_matters=') {
    if (strtolower(substr($singleCRP, 14, 5)) === 'false') {
      $html = 'caseSensitive = false';
      $nextIndex = 20;
      $caseSensitive = FALSE;
    }
    elseif (strtolower(substr($singleCRP, 14, 4)) === 'true') {
      $html = 'caseSensitive = true';
      $nextIndex = 19;
      $caseSensitive = TRUE;
    }
  }
  return [
    'html' => $html,
    'nextIndex' => $nextIndex,
    'caseSensitive' => $caseSensitive,
  ];
}