Guides

HighlightNode extends AbstractNode
in package

FinalYes

Marker node to set the default code language.

This node is never rendered; the compiler's HighlightNodeTransformer removes it from the document tree while setting the language it carries on every ConsumesDefaultHighlightLanguage node that follows it and does not already have an explicit language.

Table of Contents

Properties

$classes  : string[]
$options  : array<string, scalar|scalar[]|null>
$value  : TValue
$language  : string

Methods

__construct()  : mixed
addMetaData()  : void
Attaches data about this node that is not part of its content.
getClasses()  : string[]
getClassesString()  : string
getLanguage()  : string
getMetaData()  : array<string, DataNode>
getOption()  : mixed
getOptions()  : array<string, scalar|scalar[]|null>
getValue()  : TValue
hasOption()  : bool
setClasses()  : void
Normalizes class names following the rules of identifier-normalization
setValue()  : void
withKeepExistingOptions()  : static
Adds $options as default options without overriding any options already set.
withOptions()  : static

Properties

$options

protected array<string, scalar|scalar[]|null> $options = []

Methods

__construct()

public __construct(string $language) : mixed
Parameters
$language : string

addMetaData()

Attaches data about this node that is not part of its content.

public addMetaData(DataNode $data) : void

Rendered as a data-* attribute where the node's template asks for it. A name that is already taken gets the new values added to the ones it has, rather than replaced by them. DataNode

Parameters
$data : DataNode

getClasses()

public getClasses() : string[]
Return values
string[]

getClassesString()

public getClassesString() : string
Return values
string

getLanguage()

public getLanguage() : string
Return values
string

getOption()

public getOption(string $name[, TType|null $default = null ]) : mixed
Parameters
$name : string
$default : TType|null = null
Tags
phpstan-return

($default is null ? mixed|null: TType|null)

getOptions()

public getOptions() : array<string, scalar|scalar[]|null>
Return values
array<string, scalar|scalar[]|null>

getValue()

public getValue() : TValue
Return values
TValue

hasOption()

public hasOption(string $name) : bool
Parameters
$name : string
Return values
bool

setValue()

public setValue(TValue $value) : void
Parameters
$value : TValue

withKeepExistingOptions()

Adds $options as default options without overriding any options already set.

public withKeepExistingOptions(array<string, scalar|null> $options) : static
Parameters
$options : array<string, scalar|null>
Return values
static

withOptions()

public withOptions(array<string, scalar|scalar[]|null> $options) : static
Parameters
$options : array<string, scalar|scalar[]|null>
Return values
static
On this page

Search results