PluginProbe
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin / 6.5.1.7
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin v6.5.1.7
6.5.1.7 6.5.1.6 6.5.1.5 6.5.1.4 6.5.1.3 6.5.1.2 6.5.1.1 6.5.0.9 6.5.0.8 6.5.0.7 6.5.0.6 trunk 3.4.2.40 3.4.2.41 3.4.2.42 3.4.2.43 3.4.2.44 3.4.2.45 3.4.2.46 3.4.2.47 3.4.2.48 3.4.2.49 3.4.2.50 6.3.2 6.3.3.1 All 47 releases
wpdatatables / lib / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Helper / Size.php

Size.php in wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin 6.5.1.7, at lib/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Size.php

53 lines 926 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PhpOffice\PhpSpreadsheet\Helper;
4
5 class Size
6 {
7 const REGEXP_SIZE_VALIDATION = '/^(?P<size>\d*\.?\d+)(?P<unit>pt|px|em)?$/i';
8
9 /**
10 * @var bool
11 */
12 protected $valid;
13
14 /**
15 * @var string
16 */
17 protected $size = '';
18
19 /**
20 * @var string
21 */
22 protected $unit = '';
23
24 public function __construct(string $size)
25 {
26 $this->valid = (bool) preg_match(self::REGEXP_SIZE_VALIDATION, $size, $matches);
27 if ($this->valid) {
28 $this->size = $matches['size'];
29 $this->unit = $matches['unit'] ?? 'pt';
30 }
31 }
32
33 public function valid(): bool
34 {
35 return $this->valid;
36 }
37
38 public function size(): string
39 {
40 return $this->size;
41 }
42
43 public function unit(): string
44 {
45 return $this->unit;
46 }
47
48 public function __toString()
49 {
50 return $this->size . $this->unit;
51 }
52 }
53