chengkun
2025-09-12 26c5c0296e7c094f9a7ae4a4bb3c975796992eaf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
 
namespace PhpOffice\PhpSpreadsheet\RichText;
 
use PhpOffice\PhpSpreadsheet\Style\Font;
 
class TextElement implements ITextElement
{
    /**
     * Text.
     */
    private string $text;
 
    /**
     * Create a new TextElement instance.
     *
     * @param string $text Text
     */
    public function __construct(string $text = '')
    {
        // Initialise variables
        $this->text = $text;
    }
 
    /**
     * Get text.
     *
     * @return string Text
     */
    public function getText(): string
    {
        return $this->text;
    }
 
    /**
     * Set text.
     *
     * @param string $text Text
     *
     * @return $this
     */
    public function setText(string $text): self
    {
        $this->text = $text;
 
        return $this;
    }
 
    /**
     * Get font. For this class, the return value is always null.
     */
    public function getFont(): ?Font
    {
        return null;
    }
 
    /**
     * Get hash code.
     *
     * @return string Hash code
     */
    public function getHashCode(): string
    {
        return md5(
            $this->text
            . __CLASS__
        );
    }
}