mapByProperties($this->getProps(), $item); } /** * Summarize a DOI * * Includes properties with the apiSummary flag in the Doi schema */ public function summarize(Doi $item): array { return $this->mapByProperties($this->getSummaryProps(), $item); } /** * Map a collection of DOIs * * @see self::map */ public function mapMany(Enumerable $collection): Enumerable { $this->collection = $collection; return $collection->map(function ($item) { return $this->map($item); }); } /** * Summarize a collection of Dois * * @see self::summarize */ public function summarizeMany(Enumerable $collection): Enumerable { $this->collection = $collection; return $collection->map(function ($item) { return $this->summarize($item); }); } /** * Map schema properties of a DOI to an assoc array */ protected function mapByProperties(array $props, Doi $item): array { $output = []; foreach ($props as $prop) { switch ($prop) { case 'resolvingUrl': $output[$prop] = $item->getResolvingUrl(); break; default: $output[$prop] = $item->getData($prop); break; } } ksort($output); return $this->withExtensions($output, $item); } }