# tablepress/3.4/libraries/vendor/PhpSpreadsheet/RichText/TextElement.php

TablePress – Tables in WordPress made easy, version 3.4. 70 lines.

- Page: https://pluginprobe.com/plugins/tablepress/3.4/code/libraries/vendor/PhpSpreadsheet/RichText/TextElement.php
- Raw: https://pluginprobe.com/plugins/tablepress/3.4/raw/libraries/vendor/PhpSpreadsheet/RichText/TextElement.php
- Modified: 2025-01-08T09:25:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tablepress/3.4/code/libraries/vendor/PhpSpreadsheet/RichText/TextElement.php#L10-L20`.

```php
<?php

namespace TablePress\PhpOffice\PhpSpreadsheet\RichText;

use TablePress\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__
		);
	}
}

```
