Documentation

AbstractMatcher
in package

AbstractYes

A matcher describes a class which gets a match from the `FastHtmlTag` and will modify the tag as needed.

Table of Contents

Properties

$headlessContentBlocker  : mixed

Methods

__construct()  : mixed
C'tor.
applyConsentAttributes()  : mixed
Create HTML attributes for the content blocker.
calculateAllKeepAttributes()  : array<string|int, string>
Calculate all keep-attributes from plugins and configuration.
createPlainResultFromMatch()  : mixed
Create a basic `BlockedResult` from an `AbstractMatch`.
createResult()  : BlockedResult
Check if a given match is blocked and return a `BlockedResult` instance.
getBlockables()  : array<string|int, AbstractBlockable>
Getter.
getHeadlessContentBlocker()  : mixed
Getter.
iterateBlockablesInString()  : mixed
Iterate our blockables in a given string and save results to the `BlockedResult`.
match()  : BlockedResult
Modify the result of a tag with attributes. Please use this in conjunction with `checkMatch`.
probablyDisableDueToSkipped()  : mixed
Disable blocked result if it has the skipped-attribute.
applyCheckResultHooks()  : mixed
Allows to run hooks on a blocked result instance.
applyCommonAttributes()  : mixed
Apply common attributes for our blocked element:
applyNewLinkElement()  : mixed
Prepare the new transformed link attribute.
applyReplaceAlwaysAttributes()  : mixed
Replace all known attributes which should be always replaced.
applyVisualParent()  : mixed
Prepare visual parent depending on class.
prepareChunksFromString()  : mixed
Prepare chunks cause `pcre.jit` can lead to `PREG_JIT_STACKLIMIT_ERROR` errors In a customer scenario, it lead to an error with a string length of `8191`.

Properties

Methods

applyConsentAttributes()

Create HTML attributes for the content blocker.

public applyConsentAttributes(BlockedResult $result, AbstractMatch $match) : mixed
Parameters
$result : BlockedResult
$match : AbstractMatch

calculateAllKeepAttributes()

Calculate all keep-attributes from plugins and configuration.

public calculateAllKeepAttributes(AbstractMatch $match) : array<string|int, string>
Parameters
$match : AbstractMatch
Return values
array<string|int, string>

createPlainResultFromMatch()

Create a basic `BlockedResult` from an `AbstractMatch`.

public createPlainResultFromMatch(AbstractMatch $match) : mixed
Parameters
$match : AbstractMatch

createResult()

Check if a given match is blocked and return a `BlockedResult` instance.

public abstract createResult(AbstractMatch $match) : BlockedResult
Parameters
$match : AbstractMatch
Return values
BlockedResult

getHeadlessContentBlocker()

Getter.

public getHeadlessContentBlocker() : mixed
Tags
codeCoverageIgnore

iterateBlockablesInString()

Iterate our blockables in a given string and save results to the `BlockedResult`.

public iterateBlockablesInString(BlockedResult $result, string $string[, bool $useContainsRegularExpression = false ][, bool $multilineRegexp = false ][, array<string|int, string> $useRegularExpressionFromMap = null ][, AbstractBlockable $useBlockables = null ]) : mixed
Parameters
$result : BlockedResult
$string : string
$useContainsRegularExpression : bool = false
$multilineRegexp : bool = false
$useRegularExpressionFromMap : array<string|int, string> = null
$useBlockables : AbstractBlockable = null

match()

Modify the result of a tag with attributes. Please use this in conjunction with `checkMatch`.

public abstract match(AbstractMatch $match) : BlockedResult
Parameters
$match : AbstractMatch
Return values
BlockedResult

probablyDisableDueToSkipped()

Disable blocked result if it has the skipped-attribute.

public probablyDisableDueToSkipped(BlockedResult $result, AbstractMatch $match) : mixed
Parameters
$result : BlockedResult
$match : AbstractMatch

applyCheckResultHooks()

Allows to run hooks on a blocked result instance.

protected applyCheckResultHooks(BlockedResult $result, AbstractMatch $match) : mixed
Parameters
$result : BlockedResult
$match : AbstractMatch

applyCommonAttributes()

Apply common attributes for our blocked element:

protected applyCommonAttributes(BlockedResult $result, AbstractMatch $match[, string $linkAttribute = null ][, string $link = null ]) : mixed
  • Visual parent
  • Replaced link attribute (optional)
  • Consent attributes depending on blocked item (consent-required, ...)
  • Replace always attributes
Parameters
$result : BlockedResult
$match : AbstractMatch
$linkAttribute : string = null
$link : string = null

applyNewLinkElement()

Prepare the new transformed link attribute.

protected applyNewLinkElement(AbstractMatch $match, string $linkAttribute, string $link) : mixed
Parameters
$match : AbstractMatch
$linkAttribute : string
$link : string

applyReplaceAlwaysAttributes()

Replace all known attributes which should be always replaced.

protected applyReplaceAlwaysAttributes(AbstractMatch $match) : mixed
Parameters
$match : AbstractMatch

applyVisualParent()

Prepare visual parent depending on class.

protected applyVisualParent(AbstractMatch $match) : mixed
Parameters
$match : AbstractMatch

prepareChunksFromString()

Prepare chunks cause `pcre.jit` can lead to `PREG_JIT_STACKLIMIT_ERROR` errors In a customer scenario, it lead to an error with a string length of `8191`.

protected prepareChunksFromString(string $string[, int $maxChunkLength = 5000 ][, int $copySiblingChunkStringLength = 100 ]) : mixed

As we are using preg_match we need to ensure, that the blockable expression can find strings between two chunks (yeah, this can happen). So, add a small part of the previous and next chunk ($copySiblingChunkStringLength).

Parameters
$string : string
$maxChunkLength : int = 5000
$copySiblingChunkStringLength : int = 100

        
On this page

Search results