|
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-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: ProjectProfileFile.php 20851 2010-02-02 21:45:51Z ralph $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * @see Zend_Tool_Project_Context_Filesystem_File |
|
25 */ |
|
26 require_once 'Zend/Tool/Project/Context/Filesystem/File.php'; |
|
27 |
|
28 /** |
|
29 * @see Zend_Tool_Project_Context_System_Interface |
|
30 */ |
|
31 require_once 'Zend/Tool/Project/Context/System/Interface.php'; |
|
32 |
|
33 /** |
|
34 * @see Zend_Tool_Project_Context_System_NotOverwritable |
|
35 */ |
|
36 require_once 'Zend/Tool/Project/Context/System/NotOverwritable.php'; |
|
37 |
|
38 /** |
|
39 * @see Zend_Tool_Project_Profile_FileParser_Xml |
|
40 */ |
|
41 require_once 'Zend/Tool/Project/Profile/FileParser/Xml.php'; |
|
42 |
|
43 /** |
|
44 * This class is the front most class for utilizing Zend_Tool_Project |
|
45 * |
|
46 * A profile is a hierarchical set of resources that keep track of |
|
47 * items within a specific project. |
|
48 * |
|
49 * @category Zend |
|
50 * @package Zend_Tool |
|
51 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
52 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
53 */ |
|
54 class Zend_Tool_Project_Context_System_ProjectProfileFile |
|
55 extends Zend_Tool_Project_Context_Filesystem_File |
|
56 implements Zend_Tool_Project_Context_System_Interface, |
|
57 Zend_Tool_Project_Context_System_NotOverwritable |
|
58 { |
|
59 |
|
60 /** |
|
61 * @var string |
|
62 */ |
|
63 protected $_filesystemName = '.zfproject.xml'; |
|
64 |
|
65 /** |
|
66 * @var Zend_Tool_Project_Profile |
|
67 */ |
|
68 protected $_profile = null; |
|
69 |
|
70 /** |
|
71 * getName() |
|
72 * |
|
73 * @return string |
|
74 */ |
|
75 public function getName() |
|
76 { |
|
77 return 'ProjectProfileFile'; |
|
78 } |
|
79 |
|
80 /** |
|
81 * setProfile() |
|
82 * |
|
83 * @param Zend_Tool_Project_Profile $profile |
|
84 * @return Zend_Tool_Project_Context_System_ProjectProfileFile |
|
85 */ |
|
86 public function setProfile($profile) |
|
87 { |
|
88 $this->_profile = $profile; |
|
89 return $this; |
|
90 } |
|
91 |
|
92 /** |
|
93 * save() |
|
94 * |
|
95 * Proxy to create |
|
96 * |
|
97 * @return Zend_Tool_Project_Context_System_ProjectProfileFile |
|
98 */ |
|
99 public function save() |
|
100 { |
|
101 parent::create(); |
|
102 return $this; |
|
103 } |
|
104 |
|
105 /** |
|
106 * getContents() |
|
107 * |
|
108 * @return string |
|
109 */ |
|
110 public function getContents() |
|
111 { |
|
112 $parser = new Zend_Tool_Project_Profile_FileParser_Xml(); |
|
113 $profile = $this->_resource->getProfile(); |
|
114 $xml = $parser->serialize($profile); |
|
115 return $xml; |
|
116 } |
|
117 |
|
118 } |