Copied!
  • todo In highlight.php 10.x, replace the @final attribute with the final keyword.
  • final
  • internal // Backward compatibility properties
  • property \Mode $mode (DEPRECATED) All properties traditionally inside of $mode are now available directly from this class.
  • property bool $caseInsensitive (DEPRECATED) Due to compatibility requirements with highlight.js, use case_insensitive instead.
CloneableInstantiable
Properties
public $name = NULL
 
  • var string
Methods
public __construct( $lang, $filePath)
 
  • param string $lang
  • param string $filePath
  • throws \InvalidArgumentException when the given $filePath is inaccessible
public __get( $name)
 
  • param string $name
  • return bool|\Mode|null
public static Highlight\Mode::_normalize( $obj)
 

Fill in the missing properties that this Mode does not have.

  • internal
  • param \stdClass|null $obj
  • since 9.16.0.0
  • return void
public compile( $safeMode)
 

Compile the Language definition.

  • param bool $safeMode
  • since 9.17.1.0The 'safeMode' parameter was added.
  • return void
Properties
private static $COMMON_KEYWORDS = ['of', 'and', 'for', 'in', 'not', 'or', 'if', 'then']
 
  • var string[]
private $mode = NULL
 
  • var \Mode|null
Methods
private commonKeyword( $word)
 
  • param string $word
  • return bool
private compileKeywords( $rawKeywords, $caseSensitive)
 
  • param array<string, string>|string $rawKeywords
  • param bool $caseSensitive
  • return array<string, array<int, string|int>>
private compileMode( $mode, $parent = NULL)
 
  • param \Mode $mode
  • param \Mode|null $parent
  • return void
private dependencyOnParent( $mode)
 
  • param \Mode|null $mode
  • return bool
private expandOrCloneMode( $mode)
 
  • param \Mode $mode
  • return array<int, \stdClass|\Mode>
private inherit( $params, $_ = [])
 

Performs a shallow merge of multiple objects into one.

  • param \Mode $params the objects to merge
  • param array<string, mixed> $_
  • return \Mode
private langRe( $value, $global = false)
 
  • param string $value
  • param bool $global
  • return \RegEx
private scoreForKeyword( $keyword, $providedScore)
 
  • param string $keyword
  • param string $providedScore
  • return int
private splitAndCompile( $className, $str, array $compiledKeywords, $caseSensitive)
 
  • param string $className
  • param string $str
  • param array<string, array<int, string|int>> $compiledKeywords
  • param bool $caseSensitive
  • return void
Properties
private static $COMMON_KEYWORDS = ['of', 'and', 'for', 'in', 'not', 'or', 'if', 'then']
 
  • var string[]
Methods
public static Highlight\Mode::_normalize( $obj)
 

Fill in the missing properties that this Mode does not have.

  • internal
  • param \stdClass|null $obj
  • since 9.16.0.0
  • return void
© 2026 Bruce Wells
Search Namespaces \ Classes
Configuration