/**
  * @inheritdoc
  */
 public function filterParametersMessages(MessageBag $messages, $statusCode = self::STATUS_INVALID_FILTERS)
 {
     $prototype = $this->repository->error(self::FILTER_PARAMETERS_MESSAGES);
     $prototype = Error::cast($prototype)->setStatus($statusCode);
     $prefix = QueryParametersParserInterface::PARAM_FILTER;
     $errors = new ErrorBag($messages, $prototype, $prefix, true);
     return $errors->toArray();
 }
 public function testSourceParameter()
 {
     $messages = new MessageBag(['foo.bar.baz' => 'Some detail']);
     $expected = new Error();
     $expected->setSourceParameter('filter.foo.bar.baz')->setDetail('Some detail');
     $bag = new ErrorBag($messages, null, 'filter', true);
     $this->assertEquals($expected, current($bag->toArray()));
 }