<?php
namespace PhpOffice\PhpSpreadsheet\Chart;
> use PhpOffice\PhpSpreadsheet\RichText\RichText;
class Title
>
{
/**
* Title Caption.
*
< * @var string
> * @var array|RichText|string
> */
> private $caption = '';
>
> /**
> * Allow overlay of other elements?
> *
> * @var bool
*/
< private $caption;
> private $overlay = true;
/**
* Title Layout.
*
< * @var Layout
> * @var ?Layout
*/
private $layout;
/**
* Create a new Title.
*
< * @param null|mixed $caption
< * @param null|Layout $layout
> * @param array|RichText|string $caption
> * @param ?Layout $layout
> * @param bool $overlay
*/
< public function __construct($caption = null, Layout $layout = null)
> public function __construct($caption = '', ?Layout $layout = null, $overlay = false)
{
$this->caption = $caption;
$this->layout = $layout;
> $this->setOverlay($overlay);
}
/**
* Get caption.
*
< * @return string
> * @return array|RichText|string
*/
public function getCaption()
{
return $this->caption;
}
> public function getCaptionText(): string
/**
> {
* Set caption.
> $caption = $this->caption;
*
> if (is_string($caption)) {
* @param string $caption
> return $caption;
*
> }
* @return Title
> if ($caption instanceof RichText) {
*/
> return $caption->getPlainText();
public function setCaption($caption)
> }
{
> $retVal = '';
$this->caption = $caption;
> foreach ($caption as $textx) {
> /** @var RichText|string */
return $this;
> $text = $textx;
}
> if ($text instanceof RichText) {
> $retVal .= $text->getPlainText();
/**
> } else {
* Get Layout.
> $retVal .= $text;
*
> }
* @return Layout
> }
*/
>
public function getLayout()
> return $retVal;
{
> }
return $this->layout;
>
< * @param string $caption
> * @param array|RichText|string $caption
< * @return Title
> * @return $this
< * Get Layout.
> * Get allow overlay of other elements?
< * @return Layout
> * @return bool
< public function getLayout()
> public function getOverlay()
> {
> return $this->overlay;
> }
>
> /**
> * Set allow overlay of other elements?
> *
> * @param bool $overlay
> */
> public function setOverlay($overlay): void
> {
> $this->overlay = $overlay;
> }
>
> public function getLayout(): ?Layout