File indexing completed on 2024-06-23 05:55:51

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_Directory
0025  */
0026 // require_once 'Zend/Tool/Project/Context/Filesystem/Directory.php';
0027 
0028 /**
0029  * @see Zend_Filter
0030  */
0031 // require_once 'Zend/Filter.php';
0032 
0033 /**
0034  * @see Zend_Filter_Word_CamelCaseToDash
0035  */
0036 // require_once 'Zend/Filter/Word/CamelCaseToDash.php';
0037 
0038 /**
0039  * @see Zend_Filter_StringToLower
0040  */
0041 // require_once 'Zend/Filter/StringToLower.php';
0042 
0043 
0044 /**
0045  * This class is the front most class for utilizing Zend_Tool_Project
0046  *
0047  * A profile is a hierarchical set of resources that keep track of
0048  * items within a specific project.
0049  *
0050  * @category   Zend
0051  * @package    Zend_Tool
0052  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0053  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0054  */
0055 class Zend_Tool_Project_Context_Zf_ViewControllerScriptsDirectory extends Zend_Tool_Project_Context_Filesystem_Directory
0056 {
0057 
0058     /**
0059      * @var string
0060      */
0061     protected $_filesystemName = 'controllerName';
0062 
0063     /**
0064      * @var name
0065      */
0066     protected $_forControllerName = null;
0067 
0068     /**
0069      * init()
0070      *
0071      * @return Zend_Tool_Project_Context_Zf_ViewControllerScriptsDirectory
0072      */
0073     public function init()
0074     {
0075         $this->_forControllerName = $this->_resource->getAttribute('forControllerName');
0076         $this->_filesystemName = $this->_convertControllerNameToFilesystemName($this->_forControllerName);
0077         parent::init();
0078         return $this;
0079     }
0080 
0081     /**
0082      * getPersistentAttributes()
0083      *
0084      * @return array
0085      */
0086     public function getPersistentAttributes()
0087     {
0088         return array(
0089             'forControllerName' => $this->_forControllerName
0090             );
0091     }
0092 
0093     /**
0094      * getName()
0095      *
0096      * @return string
0097      */
0098     public function getName()
0099     {
0100         return 'ViewControllerScriptsDirectory';
0101     }
0102 
0103     protected function _convertControllerNameToFilesystemName($controllerName)
0104     {
0105         $filter = new Zend_Filter();
0106         $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash())
0107             ->addFilter(new Zend_Filter_StringToLower());
0108         return $filter->filter($controllerName);
0109     }
0110 
0111 }