예제 #1
0
 private function transformParametersToArray(ParserParameterProcessor $parameters)
 {
     if ($this->useFirstElementForPropertyLabel) {
         $parameters->addParameter($parameters->getFirst(), $this->parserData->getTitle()->getPrefixedText());
     }
     return $parameters->toArray();
 }
 /**
  * @dataProvider firstParameterDataProvider
  */
 public function testGetFirst(array $parameters, array $expected)
 {
     $instance = new ParserParameterProcessor($parameters);
     $this->assertEquals($expected['identifier'], $instance->getFirst());
 }
 private function doPrepareParameters(ParserParameterProcessor $parserParameterProcessor)
 {
     if ($parserParameterProcessor->hasParameter(self::PARAM_LINKWITH)) {
         $val = $parserParameterProcessor->getParameterValuesByKey(self::PARAM_LINKWITH);
         $parserParameterProcessor->addParameter(end($val), $this->parserData->getTitle()->getPrefixedText());
         $parserParameterProcessor->removeParameterByKey(self::PARAM_LINKWITH);
     }
     if ($this->isEnabledFirstElementAsPropertyLabel) {
         $parserParameterProcessor->addParameter($parserParameterProcessor->getFirst(), $this->parserData->getTitle()->getPrefixedText());
     }
     $parameters = $parserParameterProcessor->toArray();
     // FIXME 3.0 make sorting default by 3.0
     // Only sort for a modified sobj otherwise existing ID will change
     $sort = false;
     // This ensures that an unordered array is ordered and will produce
     // the same ID even if elements are placed differently
     if ($sort) {
         ksort($parameters);
     }
     return $parameters;
 }