|
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: ViewControllerScriptsDirectory.php 23343 2010-11-15 15:33:22Z ramon $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * @see Zend_Tool_Project_Context_Filesystem_Directory |
|
25 */ |
|
26 require_once 'Zend/Tool/Project/Context/Filesystem/Directory.php'; |
|
27 |
|
28 /** |
|
29 * @see Zend_Filter |
|
30 */ |
|
31 require_once 'Zend/Filter.php'; |
|
32 |
|
33 /** |
|
34 * @see Zend_Filter_Word_CamelCaseToDash |
|
35 */ |
|
36 require_once 'Zend/Filter/Word/CamelCaseToDash.php'; |
|
37 |
|
38 /** |
|
39 * @see Zend_Filter_StringToLower |
|
40 */ |
|
41 require_once 'Zend/Filter/StringToLower.php'; |
|
42 |
|
43 |
|
44 /** |
|
45 * This class is the front most class for utilizing Zend_Tool_Project |
|
46 * |
|
47 * A profile is a hierarchical set of resources that keep track of |
|
48 * items within a specific project. |
|
49 * |
|
50 * @category Zend |
|
51 * @package Zend_Tool |
|
52 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
53 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
54 */ |
|
55 class Zend_Tool_Project_Context_Zf_ViewControllerScriptsDirectory extends Zend_Tool_Project_Context_Filesystem_Directory |
|
56 { |
|
57 |
|
58 /** |
|
59 * @var string |
|
60 */ |
|
61 protected $_filesystemName = 'controllerName'; |
|
62 |
|
63 /** |
|
64 * @var name |
|
65 */ |
|
66 protected $_forControllerName = null; |
|
67 |
|
68 /** |
|
69 * init() |
|
70 * |
|
71 * @return Zend_Tool_Project_Context_Zf_ViewControllerScriptsDirectory |
|
72 */ |
|
73 public function init() |
|
74 { |
|
75 $this->_forControllerName = $this->_resource->getAttribute('forControllerName'); |
|
76 $this->_filesystemName = $this->_convertControllerNameToFilesystemName($this->_forControllerName); |
|
77 parent::init(); |
|
78 return $this; |
|
79 } |
|
80 |
|
81 /** |
|
82 * getPersistentAttributes() |
|
83 * |
|
84 * @return array |
|
85 */ |
|
86 public function getPersistentAttributes() |
|
87 { |
|
88 return array( |
|
89 'forControllerName' => $this->_forControllerName |
|
90 ); |
|
91 } |
|
92 |
|
93 /** |
|
94 * getName() |
|
95 * |
|
96 * @return string |
|
97 */ |
|
98 public function getName() |
|
99 { |
|
100 return 'ViewControllerScriptsDirectory'; |
|
101 } |
|
102 |
|
103 protected function _convertControllerNameToFilesystemName($controllerName) |
|
104 { |
|
105 $filter = new Zend_Filter(); |
|
106 $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash()) |
|
107 ->addFilter(new Zend_Filter_StringToLower()); |
|
108 return $filter->filter($controllerName); |
|
109 } |
|
110 |
|
111 } |