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.
   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Reader\Xml\Style;
   4  
   5  use SimpleXMLElement;
   6  
   7  class NumberFormat extends StyleBase
   8  {
   9      public function parseStyle(SimpleXMLElement $styleAttributes): array
  10      {
  11          $style = [];
  12  
  13          $fromFormats = ['\-', '\ '];
  14          $toFormats = ['-', ' '];
  15  
  16          foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
  17              $styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
  18  
  19              switch ($styleAttributeValue) {
  20                  case 'Short Date':
  21                      $styleAttributeValue = 'dd/mm/yyyy';
  22  
  23                      break;
  24              }
  25  
  26              if ($styleAttributeValue > '') {
  27                  $style['numberFormat']['formatCode'] = $styleAttributeValue;
  28              }
  29          }
  30  
  31          return $style;
  32      }
  33  }