Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Calculation\TextData;
   4  
   5  use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
   6  use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
   7  
   8  class CaseConvert
   9  {
  10      use ArrayEnabled;
  11  
  12      /**
  13       * LOWERCASE.
  14       *
  15       * Converts a string value to upper case.
  16       *
  17       * @param mixed $mixedCaseValue The string value to convert to lower case
  18       *                              Or can be an array of values
  19       *
  20       * @return array|string
  21       *         If an array of values is passed as the argument, then the returned result will also be an array
  22       *            with the same dimensions
  23       */
  24      public static function lower($mixedCaseValue)
  25      {
  26          if (is_array($mixedCaseValue)) {
  27              return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $mixedCaseValue);
  28          }
  29  
  30          $mixedCaseValue = Helpers::extractString($mixedCaseValue);
  31  
  32          return StringHelper::strToLower($mixedCaseValue);
  33      }
  34  
  35      /**
  36       * UPPERCASE.
  37       *
  38       * Converts a string value to upper case.
  39       *
  40       * @param mixed $mixedCaseValue The string value to convert to upper case
  41       *                              Or can be an array of values
  42       *
  43       * @return array|string
  44       *         If an array of values is passed as the argument, then the returned result will also be an array
  45       *            with the same dimensions
  46       */
  47      public static function upper($mixedCaseValue)
  48      {
  49          if (is_array($mixedCaseValue)) {
  50              return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $mixedCaseValue);
  51          }
  52  
  53          $mixedCaseValue = Helpers::extractString($mixedCaseValue);
  54  
  55          return StringHelper::strToUpper($mixedCaseValue);
  56      }
  57  
  58      /**
  59       * PROPERCASE.
  60       *
  61       * Converts a string value to proper or title case.
  62       *
  63       * @param mixed $mixedCaseValue The string value to convert to title case
  64       *                              Or can be an array of values
  65       *
  66       * @return array|string
  67       *         If an array of values is passed as the argument, then the returned result will also be an array
  68       *            with the same dimensions
  69       */
  70      public static function proper($mixedCaseValue)
  71      {
  72          if (is_array($mixedCaseValue)) {
  73              return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $mixedCaseValue);
  74          }
  75  
  76          $mixedCaseValue = Helpers::extractString($mixedCaseValue);
  77  
  78          return StringHelper::strToTitle($mixedCaseValue);
  79      }
  80  }