summaryrefslogtreecommitdiff
path: root/includes/model/ShiftSignupState.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/model/ShiftSignupState.php')
-rw-r--r--includes/model/ShiftSignupState.php182
1 files changed, 91 insertions, 91 deletions
diff --git a/includes/model/ShiftSignupState.php b/includes/model/ShiftSignupState.php
index 9c20a575..d5c7f457 100644
--- a/includes/model/ShiftSignupState.php
+++ b/includes/model/ShiftSignupState.php
@@ -9,40 +9,40 @@ namespace Engelsystem;
class ShiftSignupState
{
- /**
- * Shift has free places
- */
- const FREE = 'FREE';
-
- /**
- * Shift collides with users shifts
- */
- const COLLIDES = 'COLLIDES';
-
- /**
- * User cannot join because of a restricted angeltype or user is not in the angeltype
- */
- const ANGELTYPE = 'ANGELTYPE';
-
- /**
- * Shift is full
- */
- const OCCUPIED = 'OCCUPIED';
-
- /**
- * User is admin and can do what he wants.
- */
- const ADMIN = 'ADMIN';
-
- /**
- * Shift has already ended, no signup
- */
- const SHIFT_ENDED = 'SHIFT_ENDED';
-
- /**
- * User is already signed up
- */
- const SIGNED_UP = 'SIGNED_UP';
+ /**
+ * Shift has free places
+ */
+ const FREE = 'FREE';
+
+ /**
+ * Shift collides with users shifts
+ */
+ const COLLIDES = 'COLLIDES';
+
+ /**
+ * User cannot join because of a restricted angeltype or user is not in the angeltype
+ */
+ const ANGELTYPE = 'ANGELTYPE';
+
+ /**
+ * Shift is full
+ */
+ const OCCUPIED = 'OCCUPIED';
+
+ /**
+ * User is admin and can do what he wants.
+ */
+ const ADMIN = 'ADMIN';
+
+ /**
+ * Shift has already ended, no signup
+ */
+ const SHIFT_ENDED = 'SHIFT_ENDED';
+
+ /**
+ * User is already signed up
+ */
+ const SIGNED_UP = 'SIGNED_UP';
private $state;
@@ -54,69 +54,69 @@ class ShiftSignupState
$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();
-
- if ($this->valueForState($shiftSignupState->state) > $this->valueForState($this->state)) {
- $this->state = $shiftSignupState->state;
- }
- }
+ /**
+ * 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();
+
+ if ($this->valueForState($shiftSignupState->state) > $this->valueForState($this->state)) {
+ $this->state = $shiftSignupState->state;
+ }
+ }
private function valueForState($state)
{
switch ($state) {
- case ShiftSignupState::SHIFT_ENDED:
- return 100;
-
- case ShiftSignupState::SIGNED_UP:
- return 90;
-
- case ShiftSignupState::FREE:
- return 80;
-
- case ShiftSignupState::ANGELTYPE:
- case ShiftSignupState::COLLIDES:
- return 70;
-
- case ShiftSignupState::OCCUPIED:
- case ShiftSignupState::ADMIN:
- return 60;
+ case ShiftSignupState::SHIFT_ENDED:
+ return 100;
+
+ case ShiftSignupState::SIGNED_UP:
+ return 90;
+
+ case ShiftSignupState::FREE:
+ return 80;
+
+ case ShiftSignupState::ANGELTYPE:
+ case ShiftSignupState::COLLIDES:
+ return 70;
+
+ case ShiftSignupState::OCCUPIED:
+ case ShiftSignupState::ADMIN:
+ return 60;
+ }
}
+
+ /**
+ * 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;
}
- /**
- * Returns true, if signup is allowed
- */
- public function isSignupAllowed()
- {
- switch ($this->state) {
- case ShiftSignupState::FREE:
- case ShiftSignupState::ADMIN:
- return true;
+ /**
+ * How many places are free in this shift for the angeltype?
+ */
+ public function getFreeEntries()
+ {
+ return $this->freeEntries;
}
- 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;
- }
}