PackageFile.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Deploy\Package;
  7. use Magento\Framework\View\Asset;
  8. use Magento\Framework\View\Asset\Repository;
  9. /**
  10. * Deployment Package File class
  11. */
  12. class PackageFile extends Asset
  13. {
  14. /**
  15. * @var Package
  16. */
  17. private $package;
  18. /**
  19. * @var Package
  20. */
  21. private $origPackage;
  22. /**
  23. * @var string
  24. */
  25. private $deployedFileName;
  26. /**
  27. * @var string
  28. */
  29. private $deployedFilePath;
  30. /**
  31. * @var string
  32. */
  33. private $content;
  34. /**
  35. * @param Package $package
  36. * @return bool
  37. */
  38. public function setPackage(Package $package)
  39. {
  40. $this->package = $package;
  41. if ($this->origPackage === null) {
  42. $this->origPackage = $package;
  43. }
  44. $package->addFile($this);
  45. $package->addFileToMap($this);
  46. return true;
  47. }
  48. /**
  49. * @return Package
  50. */
  51. public function getPackage()
  52. {
  53. return $this->package;
  54. }
  55. /**
  56. * @return Package
  57. */
  58. public function getOrigPackage()
  59. {
  60. return $this->origPackage;
  61. }
  62. /**
  63. * @param string $name
  64. * @return bool
  65. */
  66. public function setDeployedFileName($name)
  67. {
  68. $this->deployedFileName = $name;
  69. return true;
  70. }
  71. /**
  72. * @return string
  73. */
  74. public function getDeployedFileName()
  75. {
  76. return $this->deployedFileName;
  77. }
  78. /**
  79. * @param string $name
  80. * @return bool
  81. */
  82. public function setDeployedFilePath($name)
  83. {
  84. $this->deployedFilePath = $name;
  85. return true;
  86. }
  87. /**
  88. * @return string
  89. */
  90. public function getDeployedFilePath()
  91. {
  92. return $this->deployedFilePath;
  93. }
  94. /**
  95. * @return string
  96. */
  97. public function getDeployedFileId()
  98. {
  99. if ($this->getModule()) {
  100. return $this->getModule() . Repository::FILE_ID_SEPARATOR . $this->getDeployedFileName();
  101. }
  102. return $this->getDeployedFileName();
  103. }
  104. /**
  105. * @return string
  106. */
  107. public function getContent()
  108. {
  109. return $this->content;
  110. }
  111. /**
  112. * @param string $content
  113. * @return bool
  114. */
  115. public function setContent($content)
  116. {
  117. $this->content = $content;
  118. return true;
  119. }
  120. /**
  121. * @param string $area
  122. * @return bool
  123. */
  124. public function setArea($area)
  125. {
  126. $this->area = $area;
  127. return true;
  128. }
  129. /**
  130. * @param string $theme
  131. * @return bool
  132. */
  133. public function setTheme($theme)
  134. {
  135. $this->theme = $theme;
  136. return true;
  137. }
  138. /**
  139. * @param string $locale
  140. * @return bool
  141. */
  142. public function setLocale($locale)
  143. {
  144. $this->locale = $locale;
  145. return true;
  146. }
  147. /**
  148. * @param string $module
  149. * @return bool
  150. */
  151. public function setModule($module)
  152. {
  153. $this->module = $module;
  154. return true;
  155. }
  156. }