Exemple #1
0
 public function __invoke($data, $context = null)
 {
     if (!is_array($data = parent::__invoke($data, $context))) {
         return null;
     }
     return array_filter($data, $this->callback ?: function ($value) {
         return $value !== null;
     });
 }
Exemple #2
0
 public function __invoke($data, $context = null)
 {
     $depth = $this->depth;
     $structure = parent::__invoke($data, $context);
     while (is_array($structure) && $depth--) {
         $structure = reset($structure);
     }
     return $structure;
 }
Exemple #3
0
 public function __invoke($data, $context = null)
 {
     if (!is_array($collection = parent::__invoke($data, $context))) {
         return null;
     }
     return array_map(function ($context) use($data) {
         return $this->delegate($this->transformation, $data, $context);
     }, $collection);
 }
Exemple #4
0
 public function __invoke($data, $context = null)
 {
     return parent::__invoke($data, $this->delegate($this->expression, $data, $context));
 }
Exemple #5
0
 public function __invoke($data, $context = null)
 {
     return array_merge((array) parent::__invoke($data, $context), (array) $this->delegate($this->second, $data, $context));
 }