|
| 1 | +<?php |
| 2 | +namespace Fortifi\Api\V1\Payloads; |
| 3 | +use Packaged\Helpers\Strings; |
| 4 | + |
| 5 | +class CreateAdvertiserCampaignPayload |
| 6 | + implements \JsonSerializable |
| 7 | +{ |
| 8 | + /** |
| 9 | + * FID of an Advertiser |
| 10 | + * @required |
| 11 | + */ |
| 12 | + protected $_advertiserFid; |
| 13 | + /** |
| 14 | + * FID of a valid Brand |
| 15 | + * @required |
| 16 | + */ |
| 17 | + protected $_brandFid; |
| 18 | + /** |
| 19 | + * Visiable Display Name |
| 20 | + * @required |
| 21 | + */ |
| 22 | + protected $_displayName; |
| 23 | + |
| 24 | + public function hydrate($data) |
| 25 | + { |
| 26 | + $data = (array)$data; |
| 27 | + if(isset($data["advertiserFid"])) |
| 28 | + { |
| 29 | + $this->_advertiserFid = $data["advertiserFid"]; |
| 30 | + } |
| 31 | + if(isset($data["brandFid"])) |
| 32 | + { |
| 33 | + $this->_brandFid = $data["brandFid"]; |
| 34 | + } |
| 35 | + if(isset($data["displayName"])) |
| 36 | + { |
| 37 | + $this->_displayName = $data["displayName"]; |
| 38 | + } |
| 39 | + return $this; |
| 40 | + } |
| 41 | + |
| 42 | + public function jsonSerialize() |
| 43 | + { |
| 44 | + return [ |
| 45 | + "advertiserFid" => $this->_advertiserFid, |
| 46 | + "brandFid" => $this->_brandFid, |
| 47 | + "displayName" => $this->_displayName, |
| 48 | + ]; |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * @param string $value |
| 53 | + * |
| 54 | + * @return $this |
| 55 | + */ |
| 56 | + public function setAdvertiserFid($value) |
| 57 | + { |
| 58 | + $this->_advertiserFid = $value; |
| 59 | + return $this; |
| 60 | + } |
| 61 | + |
| 62 | + /** |
| 63 | + * FID of an Advertiser |
| 64 | + * |
| 65 | + * @param mixed $default |
| 66 | + * @param bool $trim Trim Value |
| 67 | + * |
| 68 | + * @return string |
| 69 | + */ |
| 70 | + public function getAdvertiserFid($default = null, $trim = true) |
| 71 | + { |
| 72 | + $value = $this->_advertiserFid ?: $default; |
| 73 | + return $trim ? Strings::ntrim($value) : $value; |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * @param string $value |
| 78 | + * |
| 79 | + * @return $this |
| 80 | + */ |
| 81 | + public function setBrandFid($value) |
| 82 | + { |
| 83 | + $this->_brandFid = $value; |
| 84 | + return $this; |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * FID of a valid Brand |
| 89 | + * |
| 90 | + * @param mixed $default |
| 91 | + * @param bool $trim Trim Value |
| 92 | + * |
| 93 | + * @return string |
| 94 | + */ |
| 95 | + public function getBrandFid($default = null, $trim = true) |
| 96 | + { |
| 97 | + $value = $this->_brandFid ?: $default; |
| 98 | + return $trim ? Strings::ntrim($value) : $value; |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * @param string $value |
| 103 | + * |
| 104 | + * @return $this |
| 105 | + */ |
| 106 | + public function setDisplayName($value) |
| 107 | + { |
| 108 | + $this->_displayName = $value; |
| 109 | + return $this; |
| 110 | + } |
| 111 | + |
| 112 | + /** |
| 113 | + * Visiable Display Name |
| 114 | + * |
| 115 | + * @param mixed $default |
| 116 | + * @param bool $trim Trim Value |
| 117 | + * |
| 118 | + * @return string |
| 119 | + */ |
| 120 | + public function getDisplayName($default = null, $trim = true) |
| 121 | + { |
| 122 | + $value = $this->_displayName ?: $default; |
| 123 | + return $trim ? Strings::ntrim($value) : $value; |
| 124 | + } |
| 125 | +} |
0 commit comments