Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
}