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

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

- Page: https://pluginprobe.com/plugins/tablepress/3.4/code/libraries/vendor/PhpSpreadsheet/RichText/Run.php
- Raw: https://pluginprobe.com/plugins/tablepress/3.4/raw/libraries/vendor/PhpSpreadsheet/RichText/Run.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/Run.php#L10-L20`.

```php
<?php

namespace TablePress\PhpOffice\PhpSpreadsheet\RichText;

use TablePress\PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
use TablePress\PhpOffice\PhpSpreadsheet\Style\Font;

class Run extends TextElement implements ITextElement
{
	/**
	 * Font.
	 */
	private ?Font $font;

	/**
	 * Create a new Run instance.
	 *
	 * @param string $text Text
	 */
	public function __construct(string $text = '')
	{
		parent::__construct($text);
		// Initialise variables
		$this->font = new Font();
	}

	/**
	 * Get font.
	 */
	public function getFont(): ?Font
	{
		return $this->font;
	}

	public function getFontOrThrow(): Font
	{
		if ($this->font === null) {
			throw new SpreadsheetException('unexpected null font');
		}

		return $this->font;
	}

	/**
	 * Set font.
	 *
	 * @param ?Font $font Font
	 *
	 * @return $this
	 */
	public function setFont(?Font $font = null)
	{
		$this->font = $font;

		return $this;
	}

	/**
	 * Get hash code.
	 *
	 * @return string Hash code
	 */
	public function getHashCode(): string
	{
		return md5(
			$this->getText()
			. (($this->font === null) ? '' : $this->font->getHashCode())
			. __CLASS__
		);
	}
}

```
