web/lib/Zend/Tool/Project/Context/Filesystem/File.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Tool
    16  * @package    Zend_Tool
    17  * @subpackage Framework
    17  * @subpackage Framework
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id: File.php 20901 2010-02-04 16:06:12Z ralph $
    20  * @version    $Id: File.php 24593 2012-01-05 20:35:02Z matthew $
    21  */
    21  */
    22 
    22 
    23 /**
    23 /**
    24  * @see Zend_Tool_Project_Context_Filesystem_Abstract
    24  * @see Zend_Tool_Project_Context_Filesystem_Abstract
    25  */
    25  */
    31  * A profile is a hierarchical set of resources that keep track of
    31  * A profile is a hierarchical set of resources that keep track of
    32  * items within a specific project.
    32  * items within a specific project.
    33  *
    33  *
    34  * @category   Zend
    34  * @category   Zend
    35  * @package    Zend_Tool
    35  * @package    Zend_Tool
    36  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    36  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    37  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    37  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    38  */
    38  */
    39 class Zend_Tool_Project_Context_Filesystem_File extends Zend_Tool_Project_Context_Filesystem_Abstract
    39 class Zend_Tool_Project_Context_Filesystem_File extends Zend_Tool_Project_Context_Filesystem_Abstract
    40 {
    40 {
    41 
    41 
    42     protected $_fileOnlyContext = null;
    42     protected $_fileOnlyContext = null;
    43     
    43 
    44     protected $_filesystemName = null;
    44     protected $_filesystemName = null;
    45     
    45 
    46     protected $_content = null;
    46     protected $_content = null;
    47     
    47 
    48     /**
    48     /**
    49      * getName()
    49      * getName()
    50      * 
    50      *
    51      * @return string
    51      * @return string
    52      */
    52      */
    53     public function getName()
    53     public function getName()
    54     {
    54     {
    55         return 'file';
    55         return 'file';
    56     }
    56     }
    57     
    57 
    58     /**
    58     /**
    59      * init()
    59      * init()
    60      *
    60      *
    61      * @return Zend_Tool_Project_Context_Filesystem_File
    61      * @return Zend_Tool_Project_Context_Filesystem_File
    62      */
    62      */
    63     public function init()
    63     public function init()
    64     {
    64     {
    65         if ($this->_resource->hasAttribute('filesystemName')) {
    65         if ($this->_resource->hasAttribute('filesystemName')) {
    66             $this->_filesystemName = $this->_resource->getAttribute('filesystemName');
    66             $this->_filesystemName = $this->_resource->getAttribute('filesystemName');
    67         }
    67         }
    68         
    68 
    69         // check to see if this file is 
    69         // check to see if this file is
    70         if ($this->getName() == 'file') {
    70         if ($this->getName() == 'file') {
    71             $this->_initFileOnlyContext();
    71             $this->_initFileOnlyContext();
    72         }
    72         }
    73         
    73 
    74         // @potential-todo check to ensure that this 'file' resource has no children
    74         // @potential-todo check to ensure that this 'file' resource has no children
    75         parent::init();
    75         parent::init();
    76         return $this;
    76         return $this;
    77     }
    77     }
    78 
    78 
    87         if ($this->_filesystemName !== null) {
    87         if ($this->_filesystemName !== null) {
    88             $returnAttrs['filesystemName'] = $this->_filesystemName;
    88             $returnAttrs['filesystemName'] = $this->_filesystemName;
    89         }
    89         }
    90         return $returnAttrs;
    90         return $returnAttrs;
    91     }
    91     }
    92     
    92 
    93     /**
    93     /**
    94      * setResource()
    94      * setResource()
    95      *
    95      *
    96      * @param unknown_type $resource
    96      * @param unknown_type $resource
    97      */
    97      */
    99     {
    99     {
   100         $this->_resource = $resource;
   100         $this->_resource = $resource;
   101         $this->_resource->setAppendable(false);
   101         $this->_resource->setAppendable(false);
   102         return $this;
   102         return $this;
   103     }
   103     }
   104     
   104 
   105     /**
   105     /**
   106      * getResource()
   106      * getResource()
   107      * 
   107      *
   108      * @return Zend_Tool_Project_Profile_Resource
   108      * @return Zend_Tool_Project_Profile_Resource
   109      */
   109      */
   110     public function getResource()
   110     public function getResource()
   111     {
   111     {
   112         return $this->_resource;
   112         return $this->_resource;
   168         }
   168         }
   169         if ($this->_filesystemName == null) {
   169         if ($this->_filesystemName == null) {
   170             $this->_filesystemName = 'file.txt';
   170             $this->_filesystemName = 'file.txt';
   171         }
   171         }
   172     }
   172     }
   173     
   173 
   174 }
   174 }