/** * @param $subjectModel string * @param $subjectId integer * @param $subjectProperty string * @param $code integer * @param $message string * @param $messageParameters array * @param $isFixed boolean * @param $createdAt \DateTime * @return Violation */ private function generateViolation($subjectModel, $subjectId, $subjectProperty, $code, $message, array $messageParameters, $isFixed, \DateTime $createdAt) { $violation = new TestedClass(); $violation->setSubjectModel($subjectModel); $violation->setSubjectId($subjectId); $violation->setSubjectProperty($subjectProperty); $violation->setCode($code); $violation->setMessage($message); $violation->setMessageParameters($messageParameters); $violation->setFixed($isFixed); $violation->setCreatedAt($createdAt); return $violation; }
private function generateViolation($subject, $id, $code, $message) { $violation = new Violation(); $violation->setSubjectId($id); $violation->setSubjectModel($subject); $violation->setCode($code); $violation->setMessage($message); return $violation; }
/** * @param Violation $violation violation */ public function add(Violation $violation) { $violation->setSubjectModel($this->subjectModel); $violation->setSubjectId($this->subjectId); $violation->setFixed(false); if (!$violation->getId() && false !== ($key = $this->contains($violation))) { $this->violations[$key]->setFixed(false); return; } $this->violations[] = $violation; }
/** * @param Violation $violation * @return bool */ public function equals(Violation $violation) { return $this->getSubjectModel() === $violation->getSubjectModel() && $this->getSubjectId() === $violation->getSubjectId() && $this->getSubjectProperty() === $violation->getSubjectProperty() && $this->getCode() === $violation->getCode() && $this->getMessage() === $violation->getMessage() && $this->getMessageParameters() === $violation->getMessageParameters(); }