for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace TonicHealthCheck\Incident\Siren\NotificationType;
use TonicHealthCheck\Incident\IncidentInterface;
use TonicHealthCheck\Incident\Siren\Subject\SubjectInterface;
/**
* Class FileNotificationType.
*/
class FileNotificationType implements NotificationTypeInterface
{
protected $pathMessage;
* FileNotificationType constructor.
*
* @param string $pathMessage
public function __construct($pathMessage)
$this->setPathMessage($pathMessage);
}
* @param SubjectInterface $subject
* @param IncidentInterface $incident
public function notify(SubjectInterface $subject, IncidentInterface $incident)
if ($incident->getStatus() != IncidentInterface::STATUS_OK) {
file_put_contents($this->getSubjectNotifyFilePath($subject), $incident->getMessage());
* @return string
public function getPathMessage()
return $this->pathMessage;
public function setPathMessage($pathMessage)
if (!is_writable($pathMessage)) {
throw FileNotificationTypeException::dirForMessageDoesNotWritable($pathMessage);
$this->pathMessage = rtrim($pathMessage, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
public function getSubjectNotifyFilePath(SubjectInterface $subject)
return $this->getPathMessage().$subject;