/** * Return a collection off 1 month ago based on the username supplied * * @param string $username * @return ActivityDayCollection */ private function getCollectionByUsername($username) { $created = new \DateTime("-1 month"); $data = $this->repository->findAfterCreatedByUsername($created, $username); $collection = new ActivityDayCollection(); foreach ($data as $activityUsage) { $collection->add($activityUsage); } return $collection; }
/** * @param \DateTime $date * @param ActivityDayCollection $collection * @return integer */ private function calculateTotalCountByCollection(\DateTime $date, $collection) { $return = 0; $subjectCollection = $collection->getByDate($date); if (!is_null($subjectCollection)) { $return = $subjectCollection->totalCount(); } return $return; }