PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Reader / Xls / Style / CellAlignment.php

CellAlignment.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Reader/Xls/Style/CellAlignment.php

51 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Reader\Xls\Style;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Style\Alignment;
6
7 class CellAlignment
8 {
9 /**
10 * @var array<int, string>
11 */
12 protected static array $horizontalAlignmentMap = [
13 0 => Alignment::HORIZONTAL_GENERAL,
14 1 => Alignment::HORIZONTAL_LEFT,
15 2 => Alignment::HORIZONTAL_CENTER,
16 3 => Alignment::HORIZONTAL_RIGHT,
17 4 => Alignment::HORIZONTAL_FILL,
18 5 => Alignment::HORIZONTAL_JUSTIFY,
19 6 => Alignment::HORIZONTAL_CENTER_CONTINUOUS,
20 ];
21
22 /**
23 * @var array<int, string>
24 */
25 protected static array $verticalAlignmentMap = [
26 0 => Alignment::VERTICAL_TOP,
27 1 => Alignment::VERTICAL_CENTER,
28 2 => Alignment::VERTICAL_BOTTOM,
29 3 => Alignment::VERTICAL_JUSTIFY,
30 ];
31
32 public static function horizontal(Alignment $alignment, int $horizontal): void
33 {
34 if (array_key_exists($horizontal, self::$horizontalAlignmentMap)) {
35 $alignment->setHorizontal(self::$horizontalAlignmentMap[$horizontal]);
36 }
37 }
38
39 public static function vertical(Alignment $alignment, int $vertical): void
40 {
41 if (array_key_exists($vertical, self::$verticalAlignmentMap)) {
42 $alignment->setVertical(self::$verticalAlignmentMap[$vertical]);
43 }
44 }
45
46 public static function wrap(Alignment $alignment, int $wrap): void
47 {
48 $alignment->setWrapText((bool) $wrap);
49 }
50 }
51