/** * @param Exercise $exercise * @return Workout */ public function addExercise(Exercise $exercise) { $this->exercises[] = $exercise; $this->totalSeconds += $exercise->getSeconds(); $this->totalReps += $exercise->getReps(); if (!$this->type) { $this->type = str_replace(array(' Primary', ' Secondary', ' 6 reps', ' 8 reps', ' 10 reps'), '', $exercise->getType()); } $exercise->setWorkout($this); return $this; }