<?php
namespace PhpOffice\PhpSpreadsheet\RichText;
use PhpOffice\PhpSpreadsheet\Style\Font;
class Run extends TextElement implements ITextElement
{
/**
* Font.
*
< * @var Font
> * @var ?Font
*/
private $font;
/**
* Create a new Run instance.
*
< * @param string $pText Text
> * @param string $text Text
*/
< public function __construct($pText = '')
> public function __construct($text = '')
{
< parent::__construct($pText);
> parent::__construct($text);
// Initialise variables
$this->font = new Font();
}
/**
* Get font.
*
* @return null|\PhpOffice\PhpSpreadsheet\Style\Font
*/
public function getFont()
{
return $this->font;
}
/**
* Set font.
*
< * @param Font $pFont Font
> * @param Font $font Font
*
* @return $this
*/
< public function setFont(?Font $pFont = null)
> public function setFont(?Font $font = null)
{
< $this->font = $pFont;
> $this->font = $font;
return $this;
}
/**
* Get hash code.
*
* @return string Hash code
*/
public function getHashCode()
{
return md5(
$this->getText() .
< $this->font->getHashCode() .
> (($this->font === null) ? '' : $this->font->getHashCode()) .
__CLASS__
);
}
}