/** * @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; }
/** * Helper method to create a configured exercise (to test the renderPreviousExercises method). * * @return Exercise */ protected function getExercise() { $exercise = new Exercise(); $workout = new Workout(); $workout->setDate(new DateTime()); $exercise->setWorkout($workout); return $exercise; }