Menu

## TextComponentBuilder
in package
implements ComponentBuilder

TextComponentBuilder.php : 42

A builder class for text component.

##### Tags

SuppressWarnings

  (PHPMD.ExcessiveParameterList)

### Interfaces, Classes and Traits

ComponentBuilder
  The interface that has a responsibility to build component.

### Table of Contents

$actionBuilder : TemplateActionBuilder
$adjustMode : ComponentAdjustMode
$align : ComponentAlign
$color : string
$component : array<string|int, mixed>|null
$contents : array<string|int, mixed>|null
$decoration : ComponentTextDecoration
$flex : int
$gravity : ComponentGravity
$lineSpacing : string
$margin : ComponentMargin
$maxLines : int
$offsetBottom : string
$offsetEnd : string
$offsetStart : string
$offsetTop : string
$position : string
$size : ComponentFontSize
$style : ComponentTextStyle
$text : string
$weight : ComponentFontWeight
$wrap : bool
__construct() : mixed
  TextComponentBuilder constructor.
build() : array<string|int, mixed>
  Builds text component structure.
builder() : TextComponentBuilder
  Create empty TextComponentBuilder.
setAction() : TextComponentBuilder
  Set action.
setAdjustMode() : $this
  Set adjustMode
setAlign() : TextComponentBuilder
  Set align.
setColor() : TextComponentBuilder
  Set color.
setContents() : $this
  Set contents.
setDecoration() : TextComponentBuilder
  Set decoration.
setFlex() : TextComponentBuilder
  Set flex.
setGravity() : TextComponentBuilder
  Set gravity.
setLineSpacing() : TextComponentBuilder
  Set lineSpacing.
setMargin() : TextComponentBuilder
  Set margin.
setMaxLines() : TextComponentBuilder
  Set maxLines.
setOffsetBottom() : $this
  Set offsetBottom.
setOffsetEnd() : $this
  Set offsetEnd.
setOffsetStart() : $this
  Set offsetStart.
setOffsetTop() : $this
  Set offsetTop.
setPosition() : $this
  Set position.
setSize() : TextComponentBuilder
  Set size.
setStyle() : TextComponentBuilder
  Set style.
setText() : TextComponentBuilder
  Set text.
setWeight() : TextComponentBuilder
  Set weight.
setWrap() : TextComponentBuilder
  Set wrap.

### Properties

#### $actionBuilder

TextComponentBuilder.php : 71
`private TemplateActionBuilder $actionBuilder`

#### $adjustMode

TextComponentBuilder.php : 87
`private ComponentAdjustMode $adjustMode`

#### $align

TextComponentBuilder.php : 53
`private ComponentAlign $align`

#### $color

TextComponentBuilder.php : 63
`private string $color`

#### $component

TextComponentBuilder.php : 90
`private array<string|int, mixed>|null $component`

#### $contents

TextComponentBuilder.php : 69
`private array<string|int, mixed>|null $contents`

#### $decoration

TextComponentBuilder.php : 67
`private ComponentTextDecoration $decoration`

#### $flex

TextComponentBuilder.php : 47
`private int $flex`

#### $gravity

TextComponentBuilder.php : 55
`private ComponentGravity $gravity`

#### $lineSpacing

TextComponentBuilder.php : 73
`private string $lineSpacing`

#### $margin

TextComponentBuilder.php : 49
`private ComponentMargin $margin`

#### $maxLines

TextComponentBuilder.php : 59
`private int $maxLines`

#### $offsetBottom

TextComponentBuilder.php : 80
`private string $offsetBottom`

#### $offsetEnd

TextComponentBuilder.php : 84
`private string $offsetEnd`

#### $offsetStart

TextComponentBuilder.php : 82
`private string $offsetStart`

#### $offsetTop

TextComponentBuilder.php : 78
`private string $offsetTop`

#### $position

TextComponentBuilder.php : 76
`private string $position`

#### $size

TextComponentBuilder.php : 51
`private ComponentFontSize $size`

#### $style

TextComponentBuilder.php : 65
`private ComponentTextStyle $style`

#### $text

TextComponentBuilder.php : 45
`private string $text`

#### $weight

TextComponentBuilder.php : 61
`private ComponentFontWeight $weight`

#### $wrap

TextComponentBuilder.php : 57
`private bool $wrap`

### Methods

#### __construct()

TextComponentBuilder.php : 108

TextComponentBuilder constructor.

`public __construct(string|null $text[, int|null $flex = null ][, ComponentMargin|null $margin = null ][, ComponentFontSize|null $size = null ][, ComponentAlign|null $align = null ][, ComponentGravity|null $gravity = null ][, bool|null $wrap = null ][, int|null $maxLines = null ][, ComponentFontWeight|null $weight = null ][, string|null $color = null ][, TemplateActionBuilder|null $actionBuilder = null ][, string|null $lineSpacing = null ]) : mixed`

##### Parameters

$text : string|null
$flex : int|null = null
$margin : ComponentMargin|null = null
$size : ComponentFontSize|null = null
$align : ComponentAlign|null = null
$gravity : ComponentGravity|null = null
$wrap : bool|null = null
$maxLines : int|null = null
$weight : ComponentFontWeight|null = null
$color : string|null = null
$actionBuilder : TemplateActionBuilder|null = null
$lineSpacing : string|null = null

##### Return values

mixed —

#### build()

TextComponentBuilder.php : 434

Builds text component structure.

`public build() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### builder()

TextComponentBuilder.php : 141

Create empty TextComponentBuilder.

`public static builder() : TextComponentBuilder`

##### Return values

TextComponentBuilder —

#### setAction()

TextComponentBuilder.php : 313

Set action.

`public setAction(TemplateActionBuilder|null $actionBuilder) : TextComponentBuilder`

##### Parameters

$actionBuilder : TemplateActionBuilder|null

##### Return values

TextComponentBuilder —

#### setAdjustMode()

TextComponentBuilder.php : 411

Set adjustMode

`public setAdjustMode(ComponentAdjustMode|null $adjustMode) : $this`

##### Parameters

$adjustMode : ComponentAdjustMode|null

##### Return values

$this —

#### setAlign()

TextComponentBuilder.php : 205

Set align.

`public setAlign(ComponentAlign|string|null $align) : TextComponentBuilder`

##### Parameters

$align : ComponentAlign|string|null

##### Return values

TextComponentBuilder —

#### setColor()

TextComponentBuilder.php : 277

Set color.

`public setColor(string|null $color) : TextComponentBuilder`

##### Parameters

$color : string|null

##### Return values

TextComponentBuilder —

#### setContents()

TextComponentBuilder.php : 423

Set contents.

`public setContents(array<string|int, mixed>|null $contents) : $this`

##### Parameters

$contents : array<string|int, mixed>|null

  array of SpanComponentBuilder

##### Return values

$this —

#### setDecoration()

TextComponentBuilder.php : 301

Set decoration.

`public setDecoration(ComponentTextDecoration|string|null $decoration) : TextComponentBuilder`

##### Parameters

$decoration : ComponentTextDecoration|string|null

##### Return values

TextComponentBuilder —

#### setFlex()

TextComponentBuilder.php : 164

Set flex.

`public setFlex(int|null $flex) : TextComponentBuilder`

##### Parameters

$flex : int|null

##### Return values

TextComponentBuilder —

#### setGravity()

TextComponentBuilder.php : 217

Set gravity.

`public setGravity(ComponentGravity|string|null $gravity) : TextComponentBuilder`

##### Parameters

$gravity : ComponentGravity|string|null

##### Return values

TextComponentBuilder —

#### setLineSpacing()

TextComponentBuilder.php : 241

Set lineSpacing.

`public setLineSpacing(string|null $lineSpacing) : TextComponentBuilder`

##### Parameters

$lineSpacing : string|null

##### Return values

TextComponentBuilder —

#### setMargin()

TextComponentBuilder.php : 176

Set margin.

`public setMargin(ComponentMargin|string|null $margin) : TextComponentBuilder`

##### Parameters

$margin : ComponentMargin|string|null

##### Return values

TextComponentBuilder —

#### setMaxLines()

TextComponentBuilder.php : 253

Set maxLines.

`public setMaxLines(int|null $maxLines) : TextComponentBuilder`

##### Parameters

$maxLines : int|null

##### Return values

TextComponentBuilder —

#### setOffsetBottom()

TextComponentBuilder.php : 363

Set offsetBottom.

`public setOffsetBottom(string|ComponentSpacing|null $offsetBottom) : $this`

specifiable percentage, pixel and keyword. (e.g. percentage: 5% pixel: 5px keyword: none (defined in ComponentSpacing)

##### Parameters

$offsetBottom : string|ComponentSpacing|null

##### Return values

$this —

#### setOffsetEnd()

TextComponentBuilder.php : 399

Set offsetEnd.

`public setOffsetEnd(string|ComponentSpacing|null $offsetEnd) : $this`

specifiable percentage, pixel and keyword. (e.g. percentage: 5% pixel: 5px keyword: none (defined in ComponentSpacing)

##### Parameters

$offsetEnd : string|ComponentSpacing|null

##### Return values

$this —

#### setOffsetStart()

TextComponentBuilder.php : 381

Set offsetStart.

`public setOffsetStart(string|ComponentSpacing|null $offsetStart) : $this`

specifiable percentage, pixel and keyword. (e.g. percentage: 5% pixel: 5px keyword: none (defined in ComponentSpacing)

##### Parameters

$offsetStart : string|ComponentSpacing|null

##### Return values

$this —

#### setOffsetTop()

TextComponentBuilder.php : 345

Set offsetTop.

`public setOffsetTop(string|ComponentSpacing|null $offsetTop) : $this`

specifiable percentage, pixel and keyword. (e.g. percentage: 5% pixel: 5px keyword: none (defined in ComponentSpacing)

##### Parameters

$offsetTop : string|ComponentSpacing|null

##### Return values

$this —

#### setPosition()

TextComponentBuilder.php : 327

Set position.

`public setPosition(string|ComponentPosition|null $position) : $this`

specifiable relative or absolute

##### Parameters

$position : string|ComponentPosition|null

##### Return values

$this —

#### setSize()

TextComponentBuilder.php : 193

Set size.

`public setSize(ComponentFontSize|string|null $size) : TextComponentBuilder`

specifiable pixel and keyword. (e.g. pixel: 5px keyword: xxs (defined in ComponentFontSize)

##### Parameters

$size : ComponentFontSize|string|null

##### Return values

TextComponentBuilder —

#### setStyle()

TextComponentBuilder.php : 289

Set style.

`public setStyle(ComponentTextStyle|string|null $style) : TextComponentBuilder`

##### Parameters

$style : ComponentTextStyle|string|null

##### Return values

TextComponentBuilder —

#### setText()

TextComponentBuilder.php : 152

Set text.

`public setText(string $text) : TextComponentBuilder`

##### Parameters

$text : string

##### Return values

TextComponentBuilder —

#### setWeight()

TextComponentBuilder.php : 265

Set weight.

`public setWeight(ComponentFontWeight|string|null $weight) : TextComponentBuilder`

##### Parameters

$weight : ComponentFontWeight|string|null

##### Return values

TextComponentBuilder —

#### setWrap()

TextComponentBuilder.php : 229

Set wrap.

`public setWrap(bool|null $wrap) : TextComponentBuilder`

##### Parameters

$wrap : bool|null

##### Return values

TextComponentBuilder —

## Search results