API Documentation for: 1.0.1
Show:

Engine Class

Namespace: Canteen\Parser

The parser engine does the actual string substitutions

Item Index

Methods

Methods

asBoolean

(
  • str
)
Boolean static

Global functions to check for a string-based boolean

Parameters:

  • str Mixed

    The value to check as Boolean

Returns:

Boolean:

A boolean value

checkBacktrackLimit

(
  • string
)
static

The default backtrack limit for preg expressions is 100KB, we may have pages which ar larger than 100,000, and need to increase the pcre.backtrack_limit

Parameters:

  • string String

    The string to limit test

lookupValue

(
  • context
  • name
)
Mixed private

Get the nested value for a dot-syntax array/object lookup For instance, getNextVar($substitutions, 'event.name')

Parameters:

  • context Dictionary | Object

    The associative array or object

  • name String

    The do matrix name

Returns:

Mixed:

The value of the lookup

parse

(
  • content
  • substitutions
  • [profiler=null]
)
String static

Prepare the site content to be displayed This does all of the data substitutions and url fixes. The order of operations is to do the templates, loops, if blocks, then individual substitutions.

Parameters:

  • content String

    The content data

  • substitutions Dictionary

    The substitutions key => value replaces in template

  • [profiler=null] Profiler optional

    Optional profiler usage to track performance

Returns:

String:

The parsed template