-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced deliverability reporting request/models
- Loading branch information
1 parent
c2ec6a1
commit f109783
Showing
9 changed files
with
344 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class BlockListResult | ||
{ | ||
/** @var string */ | ||
public $id; | ||
|
||
/** @var string */ | ||
public $name; | ||
|
||
/** @var \Mailosaur\Models\ResultEnum */ | ||
public $result; | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'id')) { | ||
$this->id = $data->id; | ||
} | ||
|
||
if (property_exists($data, 'name')) { | ||
$this->name = $data->name; | ||
} | ||
|
||
if (property_exists($data, 'result')) { | ||
$this->result = ResultEnum::from($data->result); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class Content | ||
{ | ||
/** @var bool */ | ||
public $embed; | ||
|
||
/** @var bool */ | ||
public $iframe; | ||
|
||
/** @var bool */ | ||
public $object; | ||
|
||
/** @var bool */ | ||
public $script; | ||
|
||
/** @var bool */ | ||
public $shortUrls; | ||
|
||
/** @var int */ | ||
public $textSize; | ||
|
||
/** @var int */ | ||
public $totalSize; | ||
|
||
/** @var bool */ | ||
public $missingAlt; | ||
|
||
/** @var bool */ | ||
public $missingListUnsubscribe; | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'embed')) { | ||
$this->embed = $data->embed; | ||
} | ||
|
||
if (property_exists($data, 'iframe')) { | ||
$this->iframe = $data->iframe; | ||
} | ||
|
||
if (property_exists($data, 'object')) { | ||
$this->object = $data->object; | ||
} | ||
|
||
if (property_exists($data, 'script')) { | ||
$this->script = $data->script; | ||
} | ||
|
||
if (property_exists($data, 'shortUrls')) { | ||
$this->shortUrls = $data->shortUrls; | ||
} | ||
|
||
if (property_exists($data, 'textSize')) { | ||
$this->textSize = $data->textSize; | ||
} | ||
|
||
if (property_exists($data, 'totalSize')) { | ||
$this->totalSize = $data->totalSize; | ||
} | ||
|
||
if (property_exists($data, 'missingAlt')) { | ||
$this->missingAlt = $data->missingAlt; | ||
} | ||
|
||
if (property_exists($data, 'missingListUnsubscribe')) { | ||
$this->missingListUnsubscribe = $data->missingListUnsubscribe; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class DeliverabilityReport | ||
{ | ||
/** @var \Mailosaur\Models\EmailAuthenticationResult */ | ||
public $spf; | ||
|
||
/** @var \Mailosaur\Models\EmailAuthenticationResult[] */ | ||
public $dkim; | ||
|
||
/** @var \Mailosaur\Models\EmailAuthenticationResult */ | ||
public $dmarc; | ||
|
||
/** @var \Mailosaur\Models\BlockListResult[] */ | ||
public $blockLists = array(); | ||
|
||
/** @var \Mailosaur\Models\Content */ | ||
public $content; | ||
|
||
/** @var \Mailosaur\Models\DnsRecords */ | ||
public $dnsRecords; | ||
|
||
/** @var \Mailosaur\Models\SpamAssassinResult */ | ||
public $spamAssassin; | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'spf')) { | ||
$this->spf = new EmailAuthenticationResult($data->spf); | ||
} | ||
|
||
if (property_exists($data, 'dkim') && is_array($data->dkim)) { | ||
foreach ($data->dkim as $dkimResult) { | ||
$this->dkim[] = new EmailAuthenticationResult($dkimResult); | ||
} | ||
} | ||
|
||
if (property_exists($data, 'dmarc')) { | ||
$this->dmarc = new EmailAuthenticationResult($data->dmarc); | ||
} | ||
|
||
if (property_exists($data, 'blockLists') && is_array($data->blockLists)) { | ||
foreach ($data->blockLists as $blockList) { | ||
$this->blockLists[] = new BlockListResult($blockList); | ||
} | ||
} | ||
|
||
if (property_exists($data, 'content')) { | ||
$this->content = new Content($data->content); | ||
} | ||
|
||
if (property_exists($data, 'dnsRecords')) { | ||
$this->dnsRecords = new DnsRecords($data->dnsRecords); | ||
} | ||
|
||
if (property_exists($data, 'spamAssassin')) { | ||
$this->spamAssassin = new SpamAssassinResult($data->spamAssassin); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class DnsRecords | ||
{ | ||
/** @var string[] */ | ||
public $a; | ||
|
||
/** @var string[] */ | ||
public $mx; | ||
|
||
/** @var string[] */ | ||
public $ptr; | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'a') && is_array($data->a)) { | ||
$this->a = $data->a; | ||
} | ||
|
||
if (property_exists($data, 'mx') && is_array($data->mx)) { | ||
$this->mx = $data->mx; | ||
} | ||
|
||
if (property_exists($data, 'ptr') && is_array($data->ptr)) { | ||
$this->ptr = $data->ptr; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class EmailAuthenticationResult | ||
{ | ||
/** @var \Mailosaur\Models\ResultEnum */ | ||
public $result; | ||
|
||
/** @var string */ | ||
public $description; | ||
|
||
/** @var string */ | ||
public $rawValue; | ||
|
||
/** @var [] */ | ||
public $tags; | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'result')) { | ||
$this->result = ResultEnum::from($data->result); | ||
} | ||
|
||
if (property_exists($data, 'description')) { | ||
$this->description = $data->description; | ||
} | ||
|
||
if (property_exists($data, 'rawValue')) { | ||
$this->rawValue = $data->rawValue; | ||
} | ||
|
||
if (property_exists($data, 'tags') && is_array($data->tags)) { | ||
foreach ($data->tags as $tag) { | ||
if (is_object($tag)) { | ||
foreach ($tag as $key => $value) { | ||
$this->tags[$key] = $value; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
enum ResultEnum: string | ||
{ | ||
case Pass = "Pass"; | ||
case Warning = "Warning"; | ||
case Fail = "Fail"; | ||
case Timeout = "Timeout"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Mailosaur\Models; | ||
|
||
|
||
class SpamAssassinResult | ||
{ | ||
/** @var double */ | ||
public $score; | ||
|
||
/** @var \Mailosaur\Models\ResultEnum */ | ||
public $result; | ||
|
||
/** @var \Mailosaur\Models\SpamAssassinRule[] */ | ||
public $rules = array(); | ||
|
||
public function __construct(\stdClass $data) | ||
{ | ||
if (property_exists($data, 'score')) { | ||
$this->score = $data->score; | ||
} | ||
|
||
if (property_exists($data, 'result')) { | ||
$this->result = ResultEnum::from($data->result); | ||
} | ||
|
||
if (property_exists($data, 'rules') && is_array($data->rules)) { | ||
foreach ($data->rules as $rule) { | ||
$this->rules[] = new SpamAssassinRule($rule); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters