Search moodle.org's
Developer Documentation

See Release Notes

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