Back to Router class

Method attachBuildRule

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

Method attachBuildRule - Source code

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