all() as $item) { $collection[] = array_merge($item, [ 'type' => 'custom', ]); } foreach ((new Mapper)->all() as $item) { $collection[] = array_merge($item, [ 'type' => 'duckling', ]); } return $collection; } public function get($id) { $searcherStorage = new SearchersStorage(); if ($searcherStorage->has($id)) { return array_merge($searcherStorage->get($id), [ 'type' => 'custom', ]); } $ducklingMapper = new Mapper(); if ($ducklingMapper->has($id)) { return array_merge($ducklingMapper->get($id), [ 'type' => 'duckling', ]); } return null; } public function has($id) { $searcherStorage = new SearchersStorage(); $ducklingMapper = new Mapper(); return $searcherStorage->has($id) || $ducklingMapper->has($id); } }