TextComponentBuilder
in package
implements
ComponentBuilder
A builder class for text component.
Tags
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
private
TemplateActionBuilder
$actionBuilder
$adjustMode
private
ComponentAdjustMode
$adjustMode
$align
private
ComponentAlign
$align
$color
private
string
$color
$component
private
array<string|int, mixed>|null
$component
$contents
private
array<string|int, mixed>|null
$contents
$decoration
private
ComponentTextDecoration
$decoration
$flex
private
int
$flex
$gravity
private
ComponentGravity
$gravity
$lineSpacing
private
string
$lineSpacing
$margin
private
ComponentMargin
$margin
$maxLines
private
int
$maxLines
$offsetBottom
private
string
$offsetBottom
$offsetEnd
private
string
$offsetEnd
$offsetStart
private
string
$offsetStart
$offsetTop
private
string
$offsetTop
$position
private
string
$position
$size
private
ComponentFontSize
$size
$style
private
ComponentTextStyle
$style
$text
private
string
$text
$weight
private
ComponentFontWeight
$weight
$wrap
private
bool
$wrap
Methods
__construct()
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()
Builds text component structure.
public
build() : array<string|int, mixed>
Return values
array<string|int, mixed> —builder()
Create empty TextComponentBuilder.
public
static builder() : TextComponentBuilder
Return values
TextComponentBuilder —setAction()
Set action.
public
setAction(TemplateActionBuilder|null $actionBuilder) : TextComponentBuilder
Parameters
- $actionBuilder : TemplateActionBuilder|null
Return values
TextComponentBuilder —setAdjustMode()
Set adjustMode
public
setAdjustMode(ComponentAdjustMode|null $adjustMode) : $this
Parameters
- $adjustMode : ComponentAdjustMode|null
Return values
$this —setAlign()
Set align.
public
setAlign(ComponentAlign|string|null $align) : TextComponentBuilder
Parameters
- $align : ComponentAlign|string|null
Return values
TextComponentBuilder —setColor()
Set color.
public
setColor(string|null $color) : TextComponentBuilder
Parameters
- $color : string|null
Return values
TextComponentBuilder —setContents()
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()
Set decoration.
public
setDecoration(ComponentTextDecoration|string|null $decoration) : TextComponentBuilder
Parameters
- $decoration : ComponentTextDecoration|string|null
Return values
TextComponentBuilder —setFlex()
Set flex.
public
setFlex(int|null $flex) : TextComponentBuilder
Parameters
- $flex : int|null
Return values
TextComponentBuilder —setGravity()
Set gravity.
public
setGravity(ComponentGravity|string|null $gravity) : TextComponentBuilder
Parameters
- $gravity : ComponentGravity|string|null
Return values
TextComponentBuilder —setLineSpacing()
Set lineSpacing.
public
setLineSpacing(string|null $lineSpacing) : TextComponentBuilder
Parameters
- $lineSpacing : string|null
Return values
TextComponentBuilder —setMargin()
Set margin.
public
setMargin(ComponentMargin|string|null $margin) : TextComponentBuilder
Parameters
- $margin : ComponentMargin|string|null
Return values
TextComponentBuilder —setMaxLines()
Set maxLines.
public
setMaxLines(int|null $maxLines) : TextComponentBuilder
Parameters
- $maxLines : int|null
Return values
TextComponentBuilder —setOffsetBottom()
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()
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()
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()
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()
Set position.
public
setPosition(string|ComponentPosition|null $position) : $this
specifiable relative or absolute
Parameters
- $position : string|ComponentPosition|null
Return values
$this —setSize()
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()
Set style.
public
setStyle(ComponentTextStyle|string|null $style) : TextComponentBuilder
Parameters
- $style : ComponentTextStyle|string|null
Return values
TextComponentBuilder —setText()
Set text.
public
setText(string $text) : TextComponentBuilder
Parameters
- $text : string
Return values
TextComponentBuilder —setWeight()
Set weight.
public
setWeight(ComponentFontWeight|string|null $weight) : TextComponentBuilder
Parameters
- $weight : ComponentFontWeight|string|null
Return values
TextComponentBuilder —setWrap()
Set wrap.
public
setWrap(bool|null $wrap) : TextComponentBuilder
Parameters
- $wrap : bool|null