Content.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Downloadable\Model\File;
  7. use Magento\Downloadable\Api\Data\File\ContentInterface;
  8. /**
  9. * @codeCoverageIgnore
  10. */
  11. class Content extends \Magento\Framework\Model\AbstractExtensibleModel implements ContentInterface
  12. {
  13. const DATA = 'file_data';
  14. const NAME = 'name';
  15. /**
  16. * {@inheritdoc}
  17. * @codeCoverageIgnore
  18. */
  19. public function getFileData()
  20. {
  21. return $this->getData(self::DATA);
  22. }
  23. /**
  24. * {@inheritdoc}
  25. * @codeCoverageIgnore
  26. */
  27. public function getName()
  28. {
  29. return $this->getData(self::NAME);
  30. }
  31. /**
  32. * Set data (base64 encoded content)
  33. *
  34. * @param string $fileData
  35. * @return $this
  36. * @codeCoverageIgnore
  37. */
  38. public function setFileData($fileData)
  39. {
  40. return $this->setData(self::DATA, $fileData);
  41. }
  42. /**
  43. * Set file name
  44. *
  45. * @param string $name
  46. * @return $this
  47. * @codeCoverageIgnore
  48. */
  49. public function setName($name)
  50. {
  51. return $this->setData(self::NAME, $name);
  52. }
  53. /**
  54. * {@inheritdoc}
  55. *
  56. * @return \Magento\Downloadable\Api\Data\File\ContentExtensionInterface|null
  57. */
  58. public function getExtensionAttributes()
  59. {
  60. return $this->_getExtensionAttributes();
  61. }
  62. /**
  63. * {@inheritdoc}
  64. *
  65. * @param \Magento\Downloadable\Api\Data\File\ContentExtensionInterface $extensionAttributes
  66. * @return $this
  67. */
  68. public function setExtensionAttributes(
  69. \Magento\Downloadable\Api\Data\File\ContentExtensionInterface $extensionAttributes
  70. ) {
  71. return $this->_setExtensionAttributes($extensionAttributes);
  72. }
  73. }