CustomLine
in package
Represents a single line.
Table of Contents
Properties
- $bbox : BBox
- $fields : array<string|int, mixed>
- $rowNumber : int
Methods
- __construct() : mixed
- getLineItems() : array<string|int, mixed>
- Creates the line items.
- isBBoxInLine() : bool
- Checks if a BBox is in a given line.
- prepare() : array<string|int, mixed>
- Prepares the line items before filling them.
- updateField() : void
- Updates a field's value.
- findBestAnchor() : string
- Finds the best anchor for a given array of fields.
Properties
$bbox
public
BBox
$bbox
Simplified bounding box of the line.
$fields
public
array<string|int, mixed>
$fields
Fields contained in the line.
$rowNumber
public
int
$rowNumber
Index of the row for a given line.
Methods
__construct()
public
__construct(int $rowNumber) : mixed
Parameters
- $rowNumber : int
-
Index of the row.
getLineItems()
Creates the line items.
public
static getLineItems(array<string|int, mixed> $anchors, array<string|int, mixed> $fieldNames, array<string|int, mixed> $fields[, float $heightLineTolerance = 0.01 ]) : array<string|int, mixed>
Parameters
- $anchors : array<string|int, mixed>
-
List of anchor candidates.
- $fieldNames : array<string|int, mixed>
-
List of field names.
- $fields : array<string|int, mixed>
-
List of all fields.
- $heightLineTolerance : float = 0.01
-
Height tolerance in pixels.
Return values
array<string|int, mixed>isBBoxInLine()
Checks if a BBox is in a given line.
public
static isBBoxInLine(CustomLine $line, BBox $bbox, float $heightLineTolerance) : bool
Parameters
- $line : CustomLine
-
Current line to check.
- $bbox : BBox
-
BBox.
- $heightLineTolerance : float
-
Height tolerance in pixels.
Return values
boolprepare()
Prepares the line items before filling them.
public
static prepare(string $anchorName, array<string|int, mixed> $fields, float $heightLineTolerance) : array<string|int, mixed>
Parameters
- $anchorName : string
-
Name of the anchor.
- $fields : array<string|int, mixed>
-
List of fields.
- $heightLineTolerance : float
-
Height tolerance in pixels.
Tags
Return values
array<string|int, mixed>updateField()
Updates a field's value.
public
updateField(string $fieldName, ListFieldValue $fieldValue) : void
Parameters
- $fieldName : string
-
Name of the field.
- $fieldValue : ListFieldValue
-
Value of the field.
findBestAnchor()
Finds the best anchor for a given array of fields.
private
static findBestAnchor(array<string|int, mixed> $anchors, array<string|int, mixed> $fields) : string
Parameters
- $anchors : array<string|int, mixed>
-
Array of potential anchors.
- $fields : array<string|int, mixed>
-
Array of fields.