Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
TextRun
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Pdf\Extract\Content;
16
17/**
18 * Pdf extract content text run value object class
19 *
20 * @category   Pop
21 * @package    Pop\Pdf
22 * @author     Nick Sagona, III <nick@popphp.org>
23 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
24 * @license    https://www.popphp.org/license     New BSD License
25 * @version    6.0.0
26 */
27class TextRun
28{
29
30    /**
31     * Separator constants
32     */
33    public const SEPARATOR_NONE    = 'none';
34    public const SEPARATOR_SPACE   = 'space';
35    public const SEPARATOR_TAB     = 'tab';
36    public const SEPARATOR_NEWLINE = 'newline';
37
38    /**
39     * Constructor
40     *
41     * Instantiate a text run value object.
42     *
43     * @param ?string $fontResourceName The font resource name active for this run (e.g. "F1"), null for ActualText-substituted runs
44     * @param ?string $rawBytes         Raw undecoded bytes shown by Tj/TJ, null for ActualText-substituted runs
45     * @param ?string $decodedText      Pre-decoded ActualText replacement, null for raw-byte runs
46     * @param float   $x                Text-space x position
47     * @param float   $y                Text-space y position
48     * @param string  $separator        One of the SEPARATOR_* constants describing the gap before this run
49     * @param bool    $reversed         Whether this run is inside /ReversedChars marked content
50     * @param mixed   $font             Resolved font dict for this run, null if unresolved
51     * @param ?string $fontCacheKey     Precomputed font cache key, null to compute on demand
52     */
53    public function __construct(
54        public readonly ?string $fontResourceName,
55        public readonly ?string $rawBytes,
56        public readonly ?string $decodedText,
57        public readonly float $x,
58        public readonly float $y,
59        public readonly string $separator,
60        public readonly bool $reversed = false,
61        public readonly mixed $font = null,
62        public readonly ?string $fontCacheKey = null
63    ) {
64    }
65
66}