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 / RichText / Run.php

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

72 lines 1.1 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\RichText;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
6 use TablePress\PhpOffice\PhpSpreadsheet\Style\Font;
7
8 class Run extends TextElement implements ITextElement
9 {
10 /**
11 * Font.
12 */
13 private ?Font $font;
14
15 /**
16 * Create a new Run instance.
17 *
18 * @param string $text Text
19 */
20 public function __construct(string $text = '')
21 {
22 parent::__construct($text);
23 // Initialise variables
24 $this->font = new Font();
25 }
26
27 /**
28 * Get font.
29 */
30 public function getFont(): ?Font
31 {
32 return $this->font;
33 }
34
35 public function getFontOrThrow(): Font
36 {
37 if ($this->font === null) {
38 throw new SpreadsheetException('unexpected null font');
39 }
40
41 return $this->font;
42 }
43
44 /**
45 * Set font.
46 *
47 * @param ?Font $font Font
48 *
49 * @return $this
50 */
51 public function setFont(?Font $font = null)
52 {
53 $this->font = $font;
54
55 return $this;
56 }
57
58 /**
59 * Get hash code.
60 *
61 * @return string Hash code
62 */
63 public function getHashCode(): string
64 {
65 return md5(
66 $this->getText()
67 . (($this->font === null) ? '' : $this->font->getHashCode())
68 . __CLASS__
69 );
70 }
71 }
72