-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:mailgun/mailgun-php
- Loading branch information
Showing
3 changed files
with
125 additions
and
11 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
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,98 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* 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\Tag; | ||
|
||
use Mailgun\Model\ApiResponse; | ||
|
||
final class TagLimitResponse implements ApiResponse | ||
{ | ||
private string $id; | ||
private int $limit; | ||
private int $count; | ||
|
||
/** | ||
* @param array $data | ||
* @return self | ||
*/ | ||
public static function create(array $data): TagLimitResponse | ||
{ | ||
$item = new self(); | ||
$item->setId($data['id'] ?? ''); | ||
$item->setLimit($data['limit'] ?? 0); | ||
$item->setCount($data['count'] ?? 0); | ||
|
||
return $item; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getId(): string | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @param string $id | ||
* @return void | ||
*/ | ||
public function setId(string $id): void | ||
{ | ||
$this->id = $id; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getLimit(): int | ||
{ | ||
return $this->limit; | ||
} | ||
|
||
/** | ||
* @param int $limit | ||
* @return void | ||
*/ | ||
public function setLimit(int $limit): void | ||
{ | ||
$this->limit = $limit; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getCount(): int | ||
{ | ||
return $this->count; | ||
} | ||
|
||
/** | ||
* @param int $count | ||
* @return void | ||
*/ | ||
public function setCount(int $count): void | ||
{ | ||
$this->count = $count; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return [ | ||
'id' => $this->getId(), | ||
'limit' => $this->getLimit(), | ||
'count' => $this->getCount(), | ||
]; | ||
} | ||
} |
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