1<?php
2/**
3 * HTML API: WP_HTML_Span class
4 *
5 * @package WordPress
6 * @subpackage HTML-API
7 * @since 6.2.0
8 */
9
10/**
11 * Core class used by the HTML tag processor to represent a textual span
12 * inside an HTML document.
13 *
14 * This is a two-tuple in disguise, used to avoid the memory overhead
15 * involved in using an array for the same purpose.
16 *
17 * This class is for internal usage of the WP_HTML_Tag_Processor class.
18 *
19 * @access private
20 * @since 6.2.0
21 * @since 6.5.0 Replaced `end` with `length` to more closely align with `substr()`.
22 *
23 * @see WP_HTML_Tag_Processor
24 */
25class WP_HTML_Span {
26 /**
27 * Byte offset into document where span begins.
28 *
29 * @since 6.2.0
30 *
31 * @var int
32 */
33 public $start;
34
35 /**
36 * Byte length of this span.
37 *
38 * @since 6.5.0
39 *
40 * @var int
41 */
42 public $length;
43
44 /**
45 * Constructor.
46 *
47 * @since 6.2.0
48 *
49 * @param int $start Byte offset into document where replacement span begins.
50 * @param int $length Byte length of span.
51 */
52 public function __construct( int $start, int $length ) {
53 $this->start = $start;
54 $this->length = $length;
55 }
56}
57