Back to Router class

Method attachParseRule

public void
attachParseRule
(callable $callback, mixed $stage = self::PROCESS_DURING)
Attach a parse rule
Parameters
  • callable $callback The function to be called.
  • string $stage The stage of the parse process that this should be added to. Possible values: 'preprocess', '' for the main parse process, 'postprocess'
Returns
  • void
Since
  • 1.5
Class: Router
Project: Joomla

Method attachParseRule - Source code

/**
 * Attach a parse rule
 *
 * @param   callable  $callback  The function to be called.
 * @param   string    $stage     The stage of the parse process that
 *                               this should be added to. Possible values:
 *                               'preprocess', '' for the main parse process,
 *                               'postprocess'
 *
 * @return  void
 *
 * @since   1.5
 */
public function attachParseRule(callable $callback, $stage = self::PROCESS_DURING)
{
    if (!\array_key_exists('parse' . $stage, $this->rules)) {
        throw new \InvalidArgumentException(sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__));
    }
    $this->rules['parse' . $stage][] = $callback;
}