Attachment.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * This file is part of the Klarna KP module
  4. *
  5. * (c) Klarna Bank AB (publ)
  6. *
  7. * For the full copyright and license information, please view the NOTICE
  8. * and LICENSE files that were distributed with this source code.
  9. */
  10. namespace Klarna\Kp\Model\Api\Request;
  11. use Klarna\Kp\Api\Data\AttachmentInterface;
  12. /**
  13. * Class Attachment
  14. *
  15. * @package Klarna\Kp\Model\Api\Request
  16. */
  17. class Attachment implements AttachmentInterface
  18. {
  19. use \Klarna\Kp\Model\Api\Export;
  20. /**
  21. * @var string
  22. */
  23. private $content_type;
  24. /**
  25. * @var string
  26. */
  27. private $body;
  28. /**
  29. * Constructor.
  30. *
  31. * @param array $data
  32. */
  33. public function __construct($data = [])
  34. {
  35. foreach ($data as $key => $value) {
  36. if (property_exists($this, $key)) {
  37. $this->$key = $value;
  38. $this->exports[] = $key;
  39. }
  40. }
  41. }
  42. /**
  43. * The content type of the attachment.
  44. *
  45. * @param string $type
  46. */
  47. public function setContentType($type)
  48. {
  49. $this->content_type = $type;
  50. }
  51. /**
  52. * The body of the attachment in serialized JSON.
  53. *
  54. * @param string $body
  55. */
  56. public function setBody($body)
  57. {
  58. $this->body = $body;
  59. }
  60. }