Returns the span representing the currently-matched delimiter, if matched, otherwise null.
Description
Example:
$processor = new WP_Block_Processor( '<!-- wp:void /-->' );
null === $processor->get_span();
$processor->next_delimiter();
WP_HTML_Span( 0, 17 ) === $processor->get_span();Source
public function get_span(): ?WP_HTML_Span {
switch ( $this->state ) {
case self::HTML_SPAN:
return new WP_HTML_Span( $this->after_previous_delimiter, $this->matched_delimiter_at - $this->after_previous_delimiter );
case self::MATCHED:
return new WP_HTML_Span( $this->matched_delimiter_at, $this->matched_delimiter_length );
default:
return null;
}
}
Changelog
| Version | Description |
|---|---|
| 6.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.