ProjectProfileFile.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Tool
  17. * @subpackage Framework
  18. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Tool_Project_Context_Filesystem_File
  24. */
  25. require_once 'Zend/Tool/Project/Context/Filesystem/File.php';
  26. /**
  27. * @see Zend_Tool_Project_Context_System_Interface
  28. */
  29. require_once 'Zend/Tool/Project/Context/System/Interface.php';
  30. /**
  31. * @see Zend_Tool_Project_Context_System_NotOverwritable
  32. */
  33. require_once 'Zend/Tool/Project/Context/System/NotOverwritable.php';
  34. /**
  35. * @see Zend_Tool_Project_Profile_FileParser_Xml
  36. */
  37. require_once 'Zend/Tool/Project/Profile/FileParser/Xml.php';
  38. /**
  39. * This class is the front most class for utilizing Zend_Tool_Project
  40. *
  41. * A profile is a hierarchical set of resources that keep track of
  42. * items within a specific project.
  43. *
  44. * @category Zend
  45. * @package Zend_Tool
  46. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  47. * @license http://framework.zend.com/license/new-bsd New BSD License
  48. */
  49. class Zend_Tool_Project_Context_System_ProjectProfileFile
  50. extends Zend_Tool_Project_Context_Filesystem_File
  51. implements Zend_Tool_Project_Context_System_Interface,
  52. Zend_Tool_Project_Context_System_NotOverwritable
  53. {
  54. /**
  55. * @var string
  56. */
  57. protected $_filesystemName = '.zfproject.xml';
  58. /**
  59. * @var Zend_Tool_Project_Profile
  60. */
  61. protected $_profile = null;
  62. /**
  63. * getName()
  64. *
  65. * @return string
  66. */
  67. public function getName()
  68. {
  69. return 'ProjectProfileFile';
  70. }
  71. /**
  72. * setProfile()
  73. *
  74. * @param Zend_Tool_Project_Profile $profile
  75. * @return Zend_Tool_Project_Context_System_ProjectProfileFile
  76. */
  77. public function setProfile($profile)
  78. {
  79. $this->_profile = $profile;
  80. return $this;
  81. }
  82. /**
  83. * save()
  84. *
  85. * Proxy to create
  86. *
  87. * @return Zend_Tool_Project_Context_System_ProjectProfileFile
  88. */
  89. public function save()
  90. {
  91. parent::create();
  92. return $this;
  93. }
  94. /**
  95. * getContents()
  96. *
  97. * @return string
  98. */
  99. public function getContents()
  100. {
  101. $parser = new Zend_Tool_Project_Profile_FileParser_Xml();
  102. $profile = $this->_resource->getProfile();
  103. $xml = $parser->serialize($profile);
  104. return $xml;
  105. }
  106. }