Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   1  <?php
   2  
   3  namespace Box\Spout\Common\Entity\Style;
   4  
   5  /**
   6   * Class Alignment
   7   * This class provides constants to work with text alignment.
   8   */
   9  abstract class CellAlignment
  10  {
  11      const LEFT = 'left';
  12      const RIGHT = 'right';
  13      const CENTER = 'center';
  14      const JUSTIFY = 'justify';
  15  
  16      private static $VALID_ALIGNMENTS = [
  17          self::LEFT => 1,
  18          self::RIGHT => 1,
  19          self::CENTER => 1,
  20          self::JUSTIFY => 1,
  21      ];
  22  
  23      /**
  24       * @param string $cellAlignment
  25       *
  26       * @return bool Whether the given cell alignment is valid
  27       */
  28      public static function isValid($cellAlignment)
  29      {
  30          return isset(self::$VALID_ALIGNMENTS[$cellAlignment]);
  31      }
  32  }