/**
  * Filters the $data array according to
  * $config->getConfig()['responseFilter'] and
  * returns the filtered array
  *
  * @param JobConfig $config
  * @param array $data
  * @return array
  * @todo allow nesting
  * @todo turn into a module
  */
 protected function filterResponse(JobConfig $config, array $data)
 {
     $filter = Filter::create($config);
     return $filter->run($data);
 }
Пример #2
0
 public function testNestedArrays()
 {
     $filter = new Filter(['out.arr[].arr2[]']);
     $data = [(object) ['out' => (object) ['arr' => [(object) ['arr2' => [1, [2], (object) ['three' => 3]]]]]]];
     self::assertEquals([(object) ['out' => (object) ['arr' => [(object) ['arr2' => [1, '[2]', '{"three":3}']]]]]], $filter->run($data));
 }