mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-06 08:19:25 +03:00
Add model to map the Parse response
This commit is contained in:
parent
1fb0d0bbc5
commit
0039e26be2
67
src/Mailgun/Model/EmailValidation/Parse.php
Normal file
67
src/Mailgun/Model/EmailValidation/Parse.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Mailgun
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms
|
||||||
|
* of the MIT license. See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Mailgun\Model\EmailValidation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author David Garcia <me@davidgarcia.cat>
|
||||||
|
*/
|
||||||
|
final class Parse
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $parsed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $unparseable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse constructor.
|
||||||
|
*
|
||||||
|
* @param array $parsed
|
||||||
|
* @param array $unparseable
|
||||||
|
*/
|
||||||
|
private function __construct(array $parsed, array $unparseable)
|
||||||
|
{
|
||||||
|
$this->parsed = $parsed;
|
||||||
|
$this->unparseable = $unparseable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return Parse
|
||||||
|
*/
|
||||||
|
public static function create(array $data)
|
||||||
|
{
|
||||||
|
return new self(
|
||||||
|
((isset($data['parsed']) && is_array($data['parsed'])) ? $data['parsed'] : []),
|
||||||
|
((isset($data['unparseable']) && is_array($data['unparseable'])) ? $data['unparseable'] : [])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getParsed()
|
||||||
|
{
|
||||||
|
return $this->parsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getUnparseable()
|
||||||
|
{
|
||||||
|
return $this->unparseable;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user