<?phpnamespace App\Model;class ProcmailRule implements \JsonSerializable{ private $id; private $ruleNo; private $ruleType; private $ruleHeaderType; private $ruleValue; private $ruleDest; private $ruleFinal; private $ruleOwner; private $destExist; public function __construct() { $this->ruleHeaderType = ''; $this->destExist = null; } public function getId() : int { return $this->id; } public function setId(int $id): self { $this->id = $id; return $this; } public function getNo(): int { return $this->ruleNo; } public function setNo(int $ruleNo): self { $this->ruleNo = $ruleNo; return $this; } public function getType(): ?string { if(substr($this->ruleType, 0, 2) == "__") { return substr($this->ruleType, 2); } return $this->ruleType; } public function setType(string $ruleType): self { $this->ruleType = $ruleType; return $this; } public function getHeaderType(): ?string { return $this->ruleHeaderType; } public function setHeaderType(string $ruleType): self { $this->ruleHeaderType = $ruleType; return $this; } public function getValue(): ?string { return $this->ruleValue; } public function setValue(string $ruleValue): self { $this->ruleValue = $ruleValue; return $this; } public function getDest(): ?string { return $this->ruleDest; } public function setDest(string $ruleDest): self { $this->ruleDest = $ruleDest; return $this; } public function getFinal(): int { return $this->ruleFinal; } public function setFinal(int $ruleFinal): self { $this->ruleFinal = $ruleFinal; return $this; } public function getOwner(): ?string { return $this->ruleOwner; } public function setOwner(string $ruleOwner): self { $this->ruleOwner = $ruleOwner; return $this; } public function isEnabled() : bool { if(substr($this->ruleType, 0, 2) == "__") { return false; } return true; } public function isDestEmail() : bool { if(substr($this->ruleDest, 0, 3) == "...") { return true; } return false; } public function isDestExist() : bool { if($this->destExist == true) { return true; } return false; } public function setDestExist($exist) { $this->destExist = $exist; } public function jsonSerialize() { $vars = get_object_vars($this); return $vars; } public static function mailHeaders() { $arr = []; $arr['Auto-Submitted'] = 'Auto-Submitted'; $arr['Content-Transfer-Encoding'] = 'Content-Transfer-Encoding'; $arr['Content-Type'] = 'Content-Type'; $arr['Date'] = 'Date'; $arr['Importance'] = 'Importance'; $arr['List-Id'] = 'List-Id'; $arr['Mailing-List'] = 'Mailing-List'; $arr['MailingList'] = 'MailingList'; $arr['Message-ID'] = 'Message-ID'; $arr['MIME-Version'] = 'MIME-Version'; $arr['Organization'] = 'Organization'; $arr['Precedence'] = 'Precedence'; $arr['Received'] = 'Received'; $arr['Received-SPF'] = 'Received-SPF'; $arr['Reply-To'] = 'Reply-To'; $arr['Resent-From'] = 'Resent-From'; $arr['Resent-To'] = 'Resent-To'; $arr['Return-Path'] = 'Return-Path'; $arr['Sender'] = 'Sender'; $arr['User-Agent'] = 'User-Agent'; $arr['X-List'] = 'X-List'; $arr['X-List-Name'] = 'X-List-Name'; $arr['X-Mailer'] = 'X-Mailer'; $arr['X-Mailing-List'] = 'X-Mailing-List'; $arr['X-MailingList'] = 'X-MailingList'; $arr['X-ML-Name'] = 'X-ML-Name'; $arr['X-MSMail-Priority'] = 'X-MSMail-Priority'; $arr['X-Priority'] = 'X-Priority'; $arr['X-Qmailux-Mail-From'] = 'X-Qmailux-Mail-From'; $arr['X-Spam-Flag'] = 'X-Spam-Flag'; $arr['X-Spam-Status'] = 'X-Spam-Status'; return $arr; }}