AbstractResource.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Rest\Response\DataObject;
  6. /**
  7. * Temando API Resource Object
  8. *
  9. * Child classes may define further resource object members with type annotations:
  10. * - attributes
  11. * - links
  12. *
  13. * @package Temando\Shipping\Rest
  14. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  15. * @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  16. * @link https://www.temando.com/
  17. */
  18. abstract class AbstractResource
  19. {
  20. /**
  21. * @var string
  22. */
  23. private $type;
  24. /**
  25. * @var string
  26. */
  27. private $id;
  28. /**
  29. * One-to-one relationships
  30. *
  31. * @var \Temando\Shipping\Rest\Response\Fields\Relationship[]
  32. */
  33. private $relationships = [];
  34. /**
  35. * @return string
  36. */
  37. public function getType()
  38. {
  39. return $this->type;
  40. }
  41. /**
  42. * @param string $type
  43. * @return void
  44. */
  45. public function setType($type)
  46. {
  47. $this->type = $type;
  48. }
  49. /**
  50. * @return string
  51. */
  52. public function getId()
  53. {
  54. return $this->id;
  55. }
  56. /**
  57. * @param string $id
  58. * @return void
  59. */
  60. public function setId($id)
  61. {
  62. $this->id = $id;
  63. }
  64. /**
  65. * @return \Temando\Shipping\Rest\Response\Fields\Relationship[]
  66. */
  67. public function getRelationships()
  68. {
  69. return $this->relationships;
  70. }
  71. /**
  72. * @param \Temando\Shipping\Rest\Response\Fields\Relationship[] $relationships
  73. */
  74. public function setRelationships(array $relationships)
  75. {
  76. $this->relationships = $relationships;
  77. }
  78. }