File indexing completed on 2024-11-10 05:22:04

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Tool
0017  * @subpackage Framework
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /**
0024  * @see Zend_Tool_Project_Context_Filesystem_File
0025  */
0026 // require_once 'Zend/Tool/Project/Context/Filesystem/File.php';
0027 
0028 /**
0029  * @see Zend_Tool_Project_Context_System_Interface
0030  */
0031 // require_once 'Zend/Tool/Project/Context/System/Interface.php';
0032 
0033 /**
0034  * @see Zend_Tool_Project_Context_System_NotOverwritable
0035  */
0036 // require_once 'Zend/Tool/Project/Context/System/NotOverwritable.php';
0037 
0038 /**
0039  * @see Zend_Tool_Project_Profile_FileParser_Xml
0040  */
0041 // require_once 'Zend/Tool/Project/Profile/FileParser/Xml.php';
0042 
0043 /**
0044  * This class is the front most class for utilizing Zend_Tool_Project
0045  *
0046  * A profile is a hierarchical set of resources that keep track of
0047  * items within a specific project.
0048  *
0049  * @category   Zend
0050  * @package    Zend_Tool
0051  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0052  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0053  */
0054 class Zend_Tool_Project_Context_System_ProjectProfileFile
0055     extends Zend_Tool_Project_Context_Filesystem_File
0056     implements Zend_Tool_Project_Context_System_Interface,
0057                Zend_Tool_Project_Context_System_NotOverwritable
0058 {
0059 
0060     /**
0061      * @var string
0062      */
0063     protected $_filesystemName = '.zfproject.xml';
0064 
0065     /**
0066      * @var Zend_Tool_Project_Profile
0067      */
0068     protected $_profile = null;
0069 
0070     /**
0071      * getName()
0072      *
0073      * @return string
0074      */
0075     public function getName()
0076     {
0077         return 'ProjectProfileFile';
0078     }
0079 
0080     /**
0081      * setProfile()
0082      *
0083      * @param Zend_Tool_Project_Profile $profile
0084      * @return Zend_Tool_Project_Context_System_ProjectProfileFile
0085      */
0086     public function setProfile($profile)
0087     {
0088         $this->_profile = $profile;
0089         return $this;
0090     }
0091 
0092     /**
0093      * save()
0094      *
0095      * Proxy to create
0096      *
0097      * @return Zend_Tool_Project_Context_System_ProjectProfileFile
0098      */
0099     public function save()
0100     {
0101         parent::create();
0102         return $this;
0103     }
0104 
0105     /**
0106      * getContents()
0107      *
0108      * @return string
0109      */
0110     public function getContents()
0111     {
0112         $parser = new Zend_Tool_Project_Profile_FileParser_Xml();
0113         $profile = $this->_resource->getProfile();
0114         $xml = $parser->serialize($profile);
0115         return $xml;
0116     }
0117 
0118 }