/** * @param Parser $parser * @param ProcessingResult $result * * @return mixed */ public function handle(Parser $parser, ProcessingResult $result) { $parameters = $result->getParameters(); $this->language = $parameters['language']->getValue(); $params = $this->getFormatParameters($parameters['format']->getValue()); if ($parameters['parameters']->getValue() === 'specific') { foreach (array_keys(SMWQueryProcessor::getParameters()) as $name) { unset($params[$name]); } } elseif ($parameters['parameters']->getValue() === 'base') { foreach (array_diff_key($params, SMWQueryProcessor::getParameters()) as $param) { unset($params[$param->getName()]); } } $docBuilder = new ParameterListDocBuilder($this->newMessageFunction()); return $docBuilder->getParameterTable($params); }
public function testGivenBooleanParameter_defaultIsListedAsString() { $wikiText = $this->builder->getParameterTable(array(new ParamDefinition('boolean', 'awesome', true))); $expected = array('{| class="wikitable sortable"', '!validator-describe-header-parameter', '!validator-describe-header-type', '!validator-describe-header-default', '!validator-describe-header-description', '|-', '|awesome', '|validator-type-boolean', "|yes", '|', '|}'); $this->stringValidator->assertThatStringContains($expected, $wikiText); }