/** * Calculate for both teams number of actions * and make them happen using Action class * * @internal param TeamRepository $firstTeam * @internal param TeamRepository $secondTeam * @return \Offside\Match\MatchResults */ public function generateActions() { $firstTeam = $this->firstTeam; $secondTeam = $this->secondTeam; //initialize a MatchAction object with each team and attach to this object $firstTeamAction = $firstTeam->getNumberOfActions(); for ($counter = 0; $counter < $firstTeamAction; $counter++) { $cur_action = new Action($firstTeam, $secondTeam); $cur_action->attach($this); $cur_action->calculateResulsts(); $cur_action->detach($this); } $secondTeamAction = $firstTeam->getNumberOfActions(); for ($counter = 0; $counter < $secondTeamAction; $counter++) { $cur_action = new Action($secondTeam, $firstTeam); $cur_action->attach($this); $cur_action->calculateResulsts(); $cur_action->detach($this); } return new MatchResults($firstTeam, $secondTeam); }