DefaultCodeNodeOptionMapper
in package
implements
CodeNodeOptionMapper
uses
ReportsViolations
FinalYes
The directives `code-block` and `literalinclude` both create a CodeNode with the same possible options.
This common mapper is used by both Directives.
Table of Contents
Interfaces
- CodeNodeOptionMapper
- The directives `code-block` and `literalinclude` both create a CodeNode with the same possible options.
Constants
- LINE_NUMBER_RANGES_REGEX : mixed = '/^\d+(-\d*)?(?:,\s*\d+(-\d*)?)*$/'
Properties
- $startingRule : InlineMarkupRule
- $inlineParser : InlineParser
- $logger : LoggerInterface|ViolationReporter
Methods
- __construct() : mixed
- apply() : void
- reportViolation() : void
- setCaptionBasedOnOptions() : void
- setEmphasizeLinesBasedOnOptions() : void
- setStartingLineNumberBasedOnOptions() : void
Constants
LINE_NUMBER_RANGES_REGEX
public
mixed
LINE_NUMBER_RANGES_REGEX
= '/^\d+(-\d*)?(?:,\s*\d+(-\d*)?)*$/'
Tags
Properties
$startingRule
protected
InlineMarkupRule
$startingRule
$inlineParser read-only
private
InlineParser
$inlineParser
$logger read-only
private
LoggerInterface|ViolationReporter
$logger
Methods
__construct()
public
__construct(LoggerInterface|ViolationReporter $logger, InlineMarkupRule $startingRule, InlineParser $inlineParser) : mixed
Parameters
- $logger : LoggerInterface|ViolationReporter
- $startingRule : InlineMarkupRule
- $inlineParser : InlineParser
apply()
public
apply(CodeNode $codeNode, array<string, DirectiveOption> $directiveOptions, BlockContext $blockContext) : void
Parameters
- $codeNode : CodeNode
- $directiveOptions : array<string, DirectiveOption>
- $blockContext : BlockContext
reportViolation()
private
reportViolation(LoggerInterface|ViolationReporter|null $reporter, Violation $violation) : void
Parameters
- $reporter : LoggerInterface|ViolationReporter|null
- $violation : Violation
setCaptionBasedOnOptions()
private
setCaptionBasedOnOptions(DirectiveOption[] $options, CodeNode $node, BlockContext $blockContext) : void
Parameters
- $options : DirectiveOption[]
- $node : CodeNode
- $blockContext : BlockContext
setEmphasizeLinesBasedOnOptions()
private
setEmphasizeLinesBasedOnOptions(DirectiveOption[] $options, CodeNode $node, BlockContext $blockContext) : void
Parameters
- $options : DirectiveOption[]
- $node : CodeNode
- $blockContext : BlockContext
setStartingLineNumberBasedOnOptions()
private
setStartingLineNumberBasedOnOptions(array<string, DirectiveOption> $options, CodeNode $node) : void
Parameters
- $options : array<string, DirectiveOption>
- $node : CodeNode