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

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  * Zend_Tool_Project_Context_Filesystem_File
0025  */
0026 // require_once 'Zend/Tool/Project/Context/Filesystem/File.php';
0027 
0028 /**
0029  * This class is the front most class for utilizing Zend_Tool_Project
0030  *
0031  * A profile is a hierarchical set of resources that keep track of
0032  * items within a specific project.
0033  *
0034  * @category   Zend
0035  * @package    Zend_Tool
0036  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0037  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0038  */
0039 abstract class Zend_Tool_Project_Context_Zf_AbstractClassFile extends Zend_Tool_Project_Context_Filesystem_File
0040 {
0041 
0042     /**
0043      * getFullClassName()
0044      *
0045      * @param string $localClassName
0046      * @param string $classContextName
0047      */
0048     public function getFullClassName($localClassName, $classContextName = null)
0049     {
0050 
0051         // find the ApplicationDirectory OR ModuleDirectory
0052         $currentResource = $this->_resource;
0053         do {
0054             $resourceName = $currentResource->getName();
0055             if ($resourceName == 'ApplicationDirectory' || $resourceName == 'ModuleDirectory') {
0056                 $containingResource = $currentResource;
0057                 break;
0058             }
0059         } while ($currentResource instanceof Zend_Tool_Project_Profile_Resource
0060             && $currentResource = $currentResource->getParentResource());
0061 
0062         $fullClassName = '';
0063 
0064         // go find the proper prefix
0065         if (isset($containingResource)) {
0066             if ($containingResource->getName() == 'ApplicationDirectory') {
0067                 $prefix = $containingResource->getAttribute('classNamePrefix');
0068                 $fullClassName = $prefix;
0069             } elseif ($containingResource->getName() == 'ModuleDirectory') {
0070                 $filter = new Zend_Filter_Word_DashToCamelCase();
0071                 $prefix = $filter->filter(ucfirst($containingResource->getAttribute('moduleName'))) . '_';
0072                 $fullClassName = $prefix;
0073             }
0074         }
0075 
0076         if ($classContextName) {
0077             $fullClassName .= rtrim($classContextName, '_') . '_';
0078         }
0079         $fullClassName .= $localClassName;
0080 
0081         return $fullClassName;
0082     }
0083 
0084 }