/lib/Model/CharacterscharacterIdmailRecipients.php

https://gitlab.com/mglinski/php-esi-lib · PHP · 307 lines · 136 code · 37 blank · 134 comment · 11 complexity · 4f9bdcc49e500bcd9119d83880d8582e MD5 · raw file

  1. <?php
  2. /**
  3. * CharacterscharacterIdmailRecipients
  4. *
  5. * PHP version 5
  6. *
  7. * @category Class
  8. * @package ESI\Client
  9. * @author http://github.com/swagger-api/swagger-codegen
  10. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
  11. * @link https://github.com/swagger-api/swagger-codegen
  12. */
  13. /**
  14. * EVE Swagger Interface
  15. *
  16. * An OpenAPI for EVE Online
  17. *
  18. * OpenAPI spec version: 0.3.9
  19. *
  20. * Generated by: https://github.com/swagger-api/swagger-codegen.git
  21. *
  22. * Licensed under the Apache License, Version 2.0 (the "License");
  23. * you may not use this file except in compliance with the License.
  24. * You may obtain a copy of the License at
  25. *
  26. * http://www.apache.org/licenses/LICENSE-2.0
  27. *
  28. * Unless required by applicable law or agreed to in writing, software
  29. * distributed under the License is distributed on an "AS IS" BASIS,
  30. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  31. * See the License for the specific language governing permissions and
  32. * limitations under the License.
  33. */
  34. /**
  35. * NOTE: This class is auto generated by the swagger code generator program.
  36. * https://github.com/swagger-api/swagger-codegen
  37. * Do not edit the class manually.
  38. */
  39. namespace ESI\Client\Model;
  40. use ArrayAccess;
  41. /**
  42. * CharacterscharacterIdmailRecipients Class Doc Comment
  43. *
  44. * @category Class */
  45. // @description recipient object
  46. /**
  47. * @package ESI\Client
  48. * @author http://github.com/swagger-api/swagger-codegen
  49. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
  50. * @link https://github.com/swagger-api/swagger-codegen
  51. */
  52. class CharacterscharacterIdmailRecipients implements ArrayAccess
  53. {
  54. /**
  55. * The original name of the model.
  56. * @var string
  57. */
  58. protected static $swaggerModelName = 'characterscharacter_idmail_recipients';
  59. /**
  60. * Array of property to type mappings. Used for (de)serialization
  61. * @var string[]
  62. */
  63. protected static $swaggerTypes = array(
  64. 'recipient_id' => 'int',
  65. 'recipient_type' => 'string'
  66. );
  67. public static function swaggerTypes()
  68. {
  69. return self::$swaggerTypes;
  70. }
  71. /**
  72. * Array of attributes where the key is the local name, and the value is the original name
  73. * @var string[]
  74. */
  75. protected static $attributeMap = array(
  76. 'recipient_id' => 'recipient_id',
  77. 'recipient_type' => 'recipient_type'
  78. );
  79. public static function attributeMap()
  80. {
  81. return self::$attributeMap;
  82. }
  83. /**
  84. * Array of attributes to setter functions (for deserialization of responses)
  85. * @var string[]
  86. */
  87. protected static $setters = array(
  88. 'recipient_id' => 'setRecipientId',
  89. 'recipient_type' => 'setRecipientType'
  90. );
  91. public static function setters()
  92. {
  93. return self::$setters;
  94. }
  95. /**
  96. * Array of attributes to getter functions (for serialization of requests)
  97. * @var string[]
  98. */
  99. protected static $getters = array(
  100. 'recipient_id' => 'getRecipientId',
  101. 'recipient_type' => 'getRecipientType'
  102. );
  103. public static function getters()
  104. {
  105. return self::$getters;
  106. }
  107. const RECIPIENT_TYPE_ALLIANCE = 'alliance';
  108. const RECIPIENT_TYPE_CHARACTER = 'character';
  109. const RECIPIENT_TYPE_CORPORATION = 'corporation';
  110. const RECIPIENT_TYPE_MAILING_LIST = 'mailing_list';
  111. /**
  112. * Gets allowable values of the enum
  113. * @return string[]
  114. */
  115. public function getRecipientTypeAllowableValues()
  116. {
  117. return [
  118. self::RECIPIENT_TYPE_ALLIANCE,
  119. self::RECIPIENT_TYPE_CHARACTER,
  120. self::RECIPIENT_TYPE_CORPORATION,
  121. self::RECIPIENT_TYPE_MAILING_LIST,
  122. ];
  123. }
  124. /**
  125. * Associative array for storing property values
  126. * @var mixed[]
  127. */
  128. protected $container = array();
  129. /**
  130. * Constructor
  131. * @param mixed[] $data Associated array of property value initalizing the model
  132. */
  133. public function __construct(array $data = null)
  134. {
  135. $this->container['recipient_id'] = isset($data['recipient_id']) ? $data['recipient_id'] : null;
  136. $this->container['recipient_type'] = isset($data['recipient_type']) ? $data['recipient_type'] : null;
  137. }
  138. /**
  139. * show all the invalid properties with reasons.
  140. *
  141. * @return array invalid properties with reasons
  142. */
  143. public function listInvalidProperties()
  144. {
  145. $invalid_properties = array();
  146. if ($this->container['recipient_id'] === null) {
  147. $invalid_properties[] = "'recipient_id' can't be null";
  148. }
  149. if ($this->container['recipient_type'] === null) {
  150. $invalid_properties[] = "'recipient_type' can't be null";
  151. }
  152. $allowed_values = array("alliance", "character", "corporation", "mailing_list");
  153. if (!in_array($this->container['recipient_type'], $allowed_values)) {
  154. $invalid_properties[] = "invalid value for 'recipient_type', must be one of #{allowed_values}.";
  155. }
  156. return $invalid_properties;
  157. }
  158. /**
  159. * validate all the properties in the model
  160. * return true if all passed
  161. *
  162. * @return bool True if all properteis are valid
  163. */
  164. public function valid()
  165. {
  166. if ($this->container['recipient_id'] === null) {
  167. return false;
  168. }
  169. if ($this->container['recipient_type'] === null) {
  170. return false;
  171. }
  172. $allowed_values = array("alliance", "character", "corporation", "mailing_list");
  173. if (!in_array($this->container['recipient_type'], $allowed_values)) {
  174. return false;
  175. }
  176. return true;
  177. }
  178. /**
  179. * Gets recipient_id
  180. * @return int
  181. */
  182. public function getRecipientId()
  183. {
  184. return $this->container['recipient_id'];
  185. }
  186. /**
  187. * Sets recipient_id
  188. * @param int $recipient_id recipient_id integer
  189. * @return $this
  190. */
  191. public function setRecipientId($recipient_id)
  192. {
  193. $this->container['recipient_id'] = $recipient_id;
  194. return $this;
  195. }
  196. /**
  197. * Gets recipient_type
  198. * @return string
  199. */
  200. public function getRecipientType()
  201. {
  202. return $this->container['recipient_type'];
  203. }
  204. /**
  205. * Sets recipient_type
  206. * @param string $recipient_type recipient_type string
  207. * @return $this
  208. */
  209. public function setRecipientType($recipient_type)
  210. {
  211. $allowed_values = array('alliance', 'character', 'corporation', 'mailing_list');
  212. if (!in_array($recipient_type, $allowed_values)) {
  213. throw new \InvalidArgumentException("Invalid value for 'recipient_type', must be one of 'alliance', 'character', 'corporation', 'mailing_list'");
  214. }
  215. $this->container['recipient_type'] = $recipient_type;
  216. return $this;
  217. }
  218. /**
  219. * Returns true if offset exists. False otherwise.
  220. * @param integer $offset Offset
  221. * @return boolean
  222. */
  223. public function offsetExists($offset)
  224. {
  225. return isset($this->container[$offset]);
  226. }
  227. /**
  228. * Gets offset.
  229. * @param integer $offset Offset
  230. * @return mixed
  231. */
  232. public function offsetGet($offset)
  233. {
  234. return isset($this->container[$offset]) ? $this->container[$offset] : null;
  235. }
  236. /**
  237. * Sets value based on offset.
  238. * @param integer $offset Offset
  239. * @param mixed $value Value to be set
  240. * @return void
  241. */
  242. public function offsetSet($offset, $value)
  243. {
  244. if (is_null($offset)) {
  245. $this->container[] = $value;
  246. } else {
  247. $this->container[$offset] = $value;
  248. }
  249. }
  250. /**
  251. * Unsets offset.
  252. * @param integer $offset Offset
  253. * @return void
  254. */
  255. public function offsetUnset($offset)
  256. {
  257. unset($this->container[$offset]);
  258. }
  259. /**
  260. * Gets the string presentation of the object
  261. * @return string
  262. */
  263. public function __toString()
  264. {
  265. if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
  266. return json_encode(\ESI\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
  267. }
  268. return json_encode(\ESI\Client\ObjectSerializer::sanitizeForSerialization($this));
  269. }
  270. }