Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
   4  
   5  class Theme
   6  {
   7      /**
   8       * Theme Name.
   9       *
  10       * @var string
  11       */
  12      private $themeName;
  13  
  14      /**
  15       * Colour Scheme Name.
  16       *
  17       * @var string
  18       */
  19      private $colourSchemeName;
  20  
  21      /**
  22       * Colour Map.
  23       *
  24       * @var array of string
  25       */
  26      private $colourMap;
  27  
  28      /**
  29       * Create a new Theme.
  30       *
  31       * @param mixed $themeName
  32       * @param mixed $colourSchemeName
  33       * @param mixed $colourMap
  34       */
  35      public function __construct($themeName, $colourSchemeName, $colourMap)
  36      {
  37          // Initialise values
  38          $this->themeName = $themeName;
  39          $this->colourSchemeName = $colourSchemeName;
  40          $this->colourMap = $colourMap;
  41      }
  42  
  43      /**
  44       * Get Theme Name.
  45       *
  46       * @return string
  47       */
  48      public function getThemeName()
  49      {
  50          return $this->themeName;
  51      }
  52  
  53      /**
  54       * Get colour Scheme Name.
  55       *
  56       * @return string
  57       */
  58      public function getColourSchemeName()
  59      {
  60          return $this->colourSchemeName;
  61      }
  62  
  63      /**
  64       * Get colour Map Value by Position.
  65       *
  66       * @param mixed $index
  67       *
  68       * @return string
  69       */
  70      public function getColourByIndex($index)
  71      {
  72          if (isset($this->colourMap[$index])) {
  73              return $this->colourMap[$index];
  74          }
  75  
  76          return null;
  77      }
  78  
  79      /**
  80       * Implement PHP __clone to create a deep clone, not just a shallow copy.
  81       */
  82      public function __clone()
  83      {
  84          $vars = get_object_vars($this);
  85          foreach ($vars as $key => $value) {
  86              if ((is_object($value)) && ($key != '_parent')) {
  87                  $this->$key = clone $value;
  88              } else {
  89                  $this->$key = $value;
  90              }
  91          }
  92      }
  93  }