$occupied_by_slot Slot number => occupant. */ public static function from_occupied( array $occupied_by_slot ): self { return new self( $occupied_by_slot[1] ?? null, $occupied_by_slot[2] ?? null ); } /** * Bind the two named location fields. * * @param Location|null $location_1 First location field. * @param Location|null $location_2 Second location field. */ public function __construct( private ?Location $location_1 = null, private ?Location $location_2 = null, ) {} /** * Occupy the first empty named field. * * @param Location $location Incoming location. * @return int Slot number 1–2. * * @throws EditionLimitReached When location_1 and location_2 are both set. */ public function place( Location $location ): int { if ( null === $this->location_1 ) { $this->location_1 = $location; return 1; } if ( null === $this->location_2 ) { $this->location_2 = $location; return 2; } throw new EditionLimitReached( EditionDimension::Location, 2 ); } }