/** * @param Collection|Collection[] $items * @param string $source * * @return array */ protected function processAnnotations($items, $source) { $fields = []; if (empty($items)) { return $fields; } if ($items instanceof Collection) { $annotations = $items->getAll($this->_group); foreach ($annotations as $annotation) { $arguments = $annotation->getArguments(); $fields[] = $this->buildField($arguments, $source); } } else { foreach ($items as $column => $annotations) { if (!$annotations->has($this->_group)) { continue; } $arguments = array_merge_recursive($annotations->has('Field') ? $annotations->get('Field')->getArguments() : [], $annotations->get($this->_group)->getArguments() ?: []); $fields[] = $this->buildField($arguments, $source, $column); } } return $fields; }