web/lib/Zend/Tool/Project/Context/Zf/AbstractClassFile.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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: AbstractClassFile.php 23417 2010-11-20 16:24:35Z ramon $
       
    21  */
       
    22 
       
    23 /**
       
    24  * This class is the front most class for utilizing Zend_Tool_Project
       
    25  *
       
    26  * A profile is a hierarchical set of resources that keep track of
       
    27  * items within a specific project.
       
    28  *
       
    29  * @category   Zend
       
    30  * @package    Zend_Tool
       
    31  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    32  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    33  */
       
    34 abstract class Zend_Tool_Project_Context_Zf_AbstractClassFile extends Zend_Tool_Project_Context_Filesystem_File
       
    35 {
       
    36 
       
    37     /**
       
    38      * getFullClassName()
       
    39      *
       
    40      * @param $localClassName
       
    41      * @param $classContextName
       
    42      */
       
    43     public function getFullClassName($localClassName, $classContextName = null)
       
    44     {
       
    45 
       
    46         // find the ApplicationDirectory OR ModuleDirectory
       
    47         $currentResource = $this->_resource;
       
    48         do {
       
    49             $resourceName = $currentResource->getName();
       
    50             if ($resourceName == 'ApplicationDirectory' || $resourceName == 'ModuleDirectory') {
       
    51                 $containingResource = $currentResource;
       
    52                 break;
       
    53             }
       
    54         } while ($currentResource instanceof Zend_Tool_Project_Profile_Resource
       
    55             && $currentResource = $currentResource->getParentResource());
       
    56 
       
    57         $fullClassName = '';
       
    58 
       
    59         // go find the proper prefix
       
    60         if (isset($containingResource)) {
       
    61             if ($containingResource->getName() == 'ApplicationDirectory') {
       
    62                 $prefix = $containingResource->getAttribute('classNamePrefix');
       
    63                 $fullClassName = $prefix;
       
    64             } elseif ($containingResource->getName() == 'ModuleDirectory') {
       
    65                 $prefix = ucfirst($containingResource->getAttribute('moduleName')) . '_';
       
    66                 $fullClassName = $prefix;
       
    67             }
       
    68         }
       
    69 
       
    70         if ($classContextName) {
       
    71             $fullClassName .= rtrim($classContextName, '_') . '_';
       
    72         }
       
    73         $fullClassName .= $localClassName;
       
    74 
       
    75         return $fullClassName;
       
    76     }
       
    77 
       
    78 }