Helpers
class Helpers
| internal |
Latte helpers.
Methods
Finds the best suggestion.
Returns a reflection object for the given callable.
Sorts items by before/after ordering constraints defined as \stdClass objects.
Removes null values from the array and re-indexes it.
Attempts to map the compiled template to the source.
Tries to guess the template position from the backtrace. Returns a human-readable string like "in 'path/to/template.latte' on line 42", or null if the position cannot be determined.
Resolves template parameters from an object, its public properties are extracted as variables and annotated methods are registered as filters/functions.
Details
at line 24
static string|null
getSuggestion(array $items, string $value)
Finds the best suggestion.
at line 43
static ReflectionFunctionAbstract
toReflection(mixed $callable)
Returns a reflection object for the given callable.
Intentionally without callable type hint to avoid unhelpful error messages.
at line 64
static array
sortBeforeAfter(array $list)
Sorts items by before/after ordering constraints defined as \stdClass objects.
at line 147
static void
removeNulls(array $items)
Removes null values from the array and re-indexes it.
at line 157
static array|null
mapCompiledToSource(string $compiledFile, int|null $compiledLine = null)
Attempts to map the compiled template to the source.
at line 179
static string|null
guessTemplatePosition()
Tries to guess the template position from the backtrace. Returns a human-readable string like "in 'path/to/template.latte' on line 42", or null if the position cannot be determined.
at line 204
static array
resolveParams(Engine $engine, object|array $params)
Resolves template parameters from an object, its public properties are extracted as variables and annotated methods are registered as filters/functions.