ConditionalTableCellStyle
in package
implements
ConditionalInterface
Conditional properties for table cell styles.
Allows table cell appearance to change based on conditions.
Tags
Table of Contents
Interfaces
- ConditionalInterface
- Interface for all conditional objects.
Properties
- $backgroundColor : string|null
- The background color.
- $conditions : array<int, Condition>
- The conditions that must be met.
- $horizontalAlignment : string|null
- The horizontal alignment.
- $minimumWidth : int|null
- The minimum width.
- $padding : int|array<string, mixed>|null
- The padding.
- $textColor : string|null
- The text color.
- $verticalAlignment : string|null
- The vertical alignment.
- $width : int|null
- The cell width.
Methods
- addCondition() : $this
- Add a condition.
- darkMode() : self
- Create a dark mode cell style.
- hasConditions() : bool
- Check if any conditions have been set.
- jsonSerialize() : array<string, mixed>
- {@inheritdoc}
- setBackgroundColor() : $this
- Set the background color.
- setHorizontalAlignment() : $this
- Set the horizontal alignment.
- setMinimumWidth() : $this
- Set the minimum width.
- setPadding() : $this
- Set the padding.
- setTextColor() : $this
- Set the text color.
- setVerticalAlignment() : $this
- Set the vertical alignment.
- setWidth() : $this
- Set the cell width.
Properties
$backgroundColor
The background color.
private
string|null
$backgroundColor
= null
$conditions
The conditions that must be met.
private
array<int, Condition>
$conditions
= []
$horizontalAlignment
The horizontal alignment.
private
string|null
$horizontalAlignment
= null
$minimumWidth
The minimum width.
private
int|null
$minimumWidth
= null
$padding
The padding.
private
int|array<string, mixed>|null
$padding
= null
$textColor
The text color.
private
string|null
$textColor
= null
$verticalAlignment
The vertical alignment.
private
string|null
$verticalAlignment
= null
$width
The cell width.
private
int|null
$width
= null
Methods
addCondition()
Add a condition.
public
addCondition(Condition $condition) : $this
Parameters
- $condition : Condition
-
The condition to add.
Return values
$thisdarkMode()
Create a dark mode cell style.
public
static darkMode(string $backgroundColor[, string|null $textColor = null ]) : self
Parameters
- $backgroundColor : string
-
The dark mode background.
- $textColor : string|null = null
-
Optional dark mode text color.
Return values
self —A new instance.
hasConditions()
Check if any conditions have been set.
public
hasConditions() : bool
Return values
bool —True if conditions exist.
jsonSerialize()
{@inheritdoc}
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>setBackgroundColor()
Set the background color.
public
setBackgroundColor(string $color) : $this
Parameters
- $color : string
-
The color in hex format.
Return values
$thissetHorizontalAlignment()
Set the horizontal alignment.
public
setHorizontalAlignment(string $alignment) : $this
Parameters
- $alignment : string
-
One of 'left', 'center', 'right'.
Return values
$thissetMinimumWidth()
Set the minimum width.
public
setMinimumWidth(int $width) : $this
Parameters
- $width : int
-
The minimum width in points.
Return values
$thissetPadding()
Set the padding.
public
setPadding(int|array<string, mixed> $padding) : $this
Parameters
- $padding : int|array<string, mixed>
-
The padding.
Return values
$thissetTextColor()
Set the text color.
public
setTextColor(string $color) : $this
Parameters
- $color : string
-
The color in hex format.
Return values
$thissetVerticalAlignment()
Set the vertical alignment.
public
setVerticalAlignment(string $alignment) : $this
Parameters
- $alignment : string
-
One of 'top', 'center', 'bottom'.
Return values
$thissetWidth()
Set the cell width.
public
setWidth(int $width) : $this
Parameters
- $width : int
-
The width in points.