*/ public function appearanceIds(): array { return array_values(array_unique(array_map('intval', array_filter((array) $this->appearance_ids)))); } /** * Whether the record may be shown while this appearance is in effect: all-year ones always, seasonal ones in their seasons. */ public function fitsSeason(?Appearance $appearance): bool { return $this->appearanceIds() === [] || $this->isMadeFor($appearance); } /** * Whether the record was chosen for this appearance. */ public function isMadeFor(?Appearance $appearance): bool { return $appearance !== null && in_array($appearance->id, $this->appearanceIds(), true); } /** * Names of the appearances the record is made for (empty = all year). * * @return list */ public function appearanceNames(): array { return array_values(array_intersect_key(Appearance::names(), array_flip($this->appearanceIds()))); } }