示例#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;
     });
 }
示例#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;
 }
示例#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);
 }
示例#4
0
 public function __invoke($data, $context = null)
 {
     return parent::__invoke($data, $this->delegate($this->expression, $data, $context));
 }
示例#5
0
 public function __invoke($data, $context = null)
 {
     return array_merge((array) parent::__invoke($data, $context), (array) $this->delegate($this->second, $data, $context));
 }