FindReplace
in package
The tool of doom.
Perform find-replace actions across the whole database.
Table of Contents
Constants
- NAMESPACE : mixed = '691bf093-26a4-4d30-8a63-f7d0d94b700d'
- A namespace for mushing keys.
Properties
- $replacers : array<string|int, FindReplaceInterface>
- Registered find/replace targets.
Methods
- findIndexes() : array<string|int, array<string|int, mixed>>
- Find indexes for a set of patterns.
- getReplacer() : null|FindReplaceInterface
- Find a doomtool by it's key.
- getReplacers() : array<string|int, FindReplaceInterface>
- Get all doomtools.
- getSample() : string
- Create a sample highlight using indexes.
- register() : void
- Register a doomtool instance.
Constants
NAMESPACE
A namespace for mushing keys.
public
mixed
NAMESPACE
= '691bf093-26a4-4d30-8a63-f7d0d94b700d'
Wrap your keys in UUIDv5 with this to make it smaller but also URL safe.
Properties
$replacers
Registered find/replace targets.
private
static array<string|int, FindReplaceInterface>
$replacers
= []
Methods
findIndexes()
Find indexes for a set of patterns.
public
static findIndexes(string $text, array<string|int, mixed> $finds[, bool $ignore_case = true ]) : array<string|int, array<string|int, mixed>>
Parameters
- $text : string
- $finds : array<string|int, mixed>
- $ignore_case : bool = true
Return values
array<string|int, array<string|int, mixed>> —[ start, length ]
getReplacer()
Find a doomtool by it's key.
public
static getReplacer(string $key) : null|FindReplaceInterface
This permits passing instance/configs via GET/POST params.
Parameters
- $key : string
Return values
null|FindReplaceInterfacegetReplacers()
Get all doomtools.
public
static getReplacers([array<string|int, string>|null $keys = null ]) : array<string|int, FindReplaceInterface>
Or provide a set of keys.
Parameters
- $keys : array<string|int, string>|null = null
Return values
array<string|int, FindReplaceInterface>getSample()
Create a sample highlight using indexes.
public
static getSample(string $text, array<string|int, mixed> $index[, int $padding = 20 ]) : string
Indexes can be sourced from the replacer find() results.
Parameters
- $text : string
- $index : array<string|int, mixed>
-
[ start, length ]
- $padding : int = 20
Tags
Return values
string —HTML-safe snippet
register()
Register a doomtool instance.
public
static register(FindReplaceInterface $replace) : void
Parameters
- $replace : FindReplaceInterface