Provide Validate Response

This commit is contained in:
David Garcia 2017-12-08 01:03:28 +00:00 committed by David Garcia
parent 96b2242d5b
commit 77b50d3d17

View File

@ -0,0 +1,68 @@
<?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\Response;
use Mailgun\Model\ApiResponse;
use Mailgun\Model\EmailValidation\EmailValidation;
/**
* @author David Garcia <me@davidgarcia.cat>
*/
final class ValidateResponse implements ApiResponse
{
/**
* @var string
*/
private $message;
/**
* @var EmailValidation
*/
private $emailValidation;
/**
* {@inheritdoc}
*/
public static function create(array $data)
{
$message = isset($data['message']) ? $data['message'] : null;
$route = isset($data['route']) ? EmailValidation::create($data['emailValidation']) : null;
return new self($message, $route);
}
/**
* CreateResponse Private Constructor.
*
* @param string|null $message
* @param EmailValidation|null $emailValidation
*/
private function __construct($message = null, EmailValidation $emailValidation = null)
{
$this->message = $message;
$this->emailValidation = $emailValidation;
}
/**
* @return string
*/
public function getMessage()
{
return $this->message;
}
/**
* @return EmailValidation
*/
public function getEmailValidation()
{
return $this->emailValidation;
}
}