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 / Helper / Size.php

Size.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Helper/Size.php

38 lines 753 B
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\Helper;
4
5 use Stringable;
6
7 class Size
8 {
9 const REGEXP_SIZE_VALIDATION = '/^(?P<size>\d*\.?\d+)(?P<unit>pt|px|em)?$/i';
10 protected bool $valid = false;
11 protected string $size = '';
12 protected string $unit = '';
13 public function __construct(string $size)
14 {
15 if (1 === preg_match(self::REGEXP_SIZE_VALIDATION, $size, $matches)) {
16 $this->valid = true;
17 $this->size = $matches['size'];
18 $this->unit = $matches['unit'] ?? 'pt';
19 }
20 }
21 public function valid(): bool
22 {
23 return $this->valid;
24 }
25 public function size(): string
26 {
27 return $this->size;
28 }
29 public function unit(): string
30 {
31 return $this->unit;
32 }
33 public function __toString(): string
34 {
35 return $this->size . $this->unit;
36 }
37 }
38