Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.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 vertical alignment.
   9   */
  10  final class CellVerticalAlignment
  11  {
  12      public const AUTO = 'auto';
  13      public const BASELINE = 'baseline';
  14      public const BOTTOM = 'bottom';
  15      public const CENTER = 'center';
  16      public const DISTRIBUTED = 'distributed';
  17      public const JUSTIFY = 'justify';
  18      public const TOP = 'top';
  19  
  20      private const VALID_ALIGNMENTS = [
  21          self::AUTO => 1,
  22          self::BASELINE => 1,
  23          self::BOTTOM => 1,
  24          self::CENTER => 1,
  25          self::DISTRIBUTED => 1,
  26          self::JUSTIFY => 1,
  27          self::TOP => 1,
  28      ];
  29  
  30      /**
  31       * @return bool Whether the given cell vertical alignment is valid
  32       */
  33      public static function isValid(string $cellVerticalAlignment): bool
  34      {
  35          return isset(self::VALID_ALIGNMENTS[$cellVerticalAlignment]);
  36      }
  37  }