state = $state; $this->freeEntries = $free_entries; } /** * Combine this state with another state from the same shift. * * @param ShiftSignupState $shiftSignupState * The other state to combine */ public function combineWith(ShiftSignupState $shiftSignupState) { $this->freeEntries += $shiftSignupState->getFreeEntries(); switch ($this->state) { case ShiftSignupState::ANGELTYPE: case ShiftSignupState::OCCUPIED: $this->state = $shiftSignupState->getState(); } } /** * Returns true, if signup is allowed */ public function isSignupAllowed() { switch ($this->state) { case ShiftSignupState::FREE: case ShiftSignupState::ADMIN: return true; } return false; } /** * Return the shift signup state */ public function getState() { return $this->state; } /** * How many places are free in this shift for the angeltype? */ public function getFreeEntries() { return $this->freeEntries; } } ?>