Exemple #1
0
 /**
  * Creates contribution review model.
  *
  * Returns model if successfully added.
  *
  * @param Project $project Project model to relate with model
  * @param BaseCommit $commit Contribution model to relate with model
  * @param ContributorInterface $contributor Contributor model
  * @param ContributorInterface $reviewer Reviewer model (null if set to default contributor reviewer)
  *
  * @return ContributionReview|null
  */
 public function createContributionReview(Project $project, BaseCommit $commit, ContributorInterface $contributor, $reviewer = null)
 {
     $model = new ContributionReview();
     $model->setAttributes(['commit_id' => $commit->getId(), 'project_id' => $project->id, 'date' => $commit->getDate()->format('Y-m-d H:i:s'), 'message' => $commit->message, 'contributor_name' => $commit->contributorName, 'contributor_email' => $commit->contributorEmail, 'repo_type' => $project->repo_type, 'contributor_id' => $contributor->getContributorId(), 'reviewer_id' => $reviewer instanceof ContributorInterface ? $reviewer->getContributorId() : $contributor->getDefaultViewerId()]);
     if ($model->save()) {
         return $model;
     }
     return null;
 }
Exemple #2
0
 /**
  * Push new commit to stack and check him level.
  * Used static var to check head levels commits.
  *
  * @staticvar array $headLevels
  * @param BaseCommit $commit
  */
 public function pushCommit(BaseCommit $commit)
 {
     $this->commits[$commit->getId()] = $commit;
     $this->levels = max($commit->graphLevel, $this->levels);
 }