PageRenderTime 4ms CodeModel.GetById 0ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/zf/library/Zend/Tool/Project/Context/Zf/AbstractClassFile.php

http://github.com/eryx/php-framework-benchmark
PHP | 84 lines | 33 code | 9 blank | 42 comment | 11 complexity | f04f06fdaee898a804dd2593783e852d MD5 | raw file
Possible License(s): MIT, BSD-3-Clause, Apache-2.0, LGPL-2.1, LGPL-3.0, BSD-2-Clause
 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-2011 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 24161 2011-06-28 16:41:59Z adamlundrigan $
21 */
22
23/**
24 * Zend_Tool_Project_Context_Filesystem_File
25 */
26require_once 'Zend/Tool/Project/Context/Filesystem/File.php';
27
28/**
29 * This class is the front most class for utilizing Zend_Tool_Project
30 *
31 * A profile is a hierarchical set of resources that keep track of
32 * items within a specific project.
33 *
34 * @category   Zend
35 * @package    Zend_Tool
36 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
37 * @license    http://framework.zend.com/license/new-bsd     New BSD License
38 */
39abstract class Zend_Tool_Project_Context_Zf_AbstractClassFile extends Zend_Tool_Project_Context_Filesystem_File
40{
41
42    /**
43     * getFullClassName()
44     *
45     * @param string $localClassName
46     * @param string $classContextName
47     */
48    public function getFullClassName($localClassName, $classContextName = null)
49    {
50
51        // find the ApplicationDirectory OR ModuleDirectory
52        $currentResource = $this->_resource;
53        do {
54            $resourceName = $currentResource->getName();
55            if ($resourceName == 'ApplicationDirectory' || $resourceName == 'ModuleDirectory') {
56                $containingResource = $currentResource;
57                break;
58            }
59        } while ($currentResource instanceof Zend_Tool_Project_Profile_Resource
60            && $currentResource = $currentResource->getParentResource());
61
62        $fullClassName = '';
63
64        // go find the proper prefix
65        if (isset($containingResource)) {
66            if ($containingResource->getName() == 'ApplicationDirectory') {
67                $prefix = $containingResource->getAttribute('classNamePrefix');
68                $fullClassName = $prefix;
69            } elseif ($containingResource->getName() == 'ModuleDirectory') {
70                $filter = new Zend_Filter_Word_DashToCamelCase();
71                $prefix = $filter->filter(ucfirst($containingResource->getAttribute('moduleName'))) . '_';
72                $fullClassName = $prefix;
73            }
74        }
75
76        if ($classContextName) {
77            $fullClassName .= rtrim($classContextName, '_') . '_';
78        }
79        $fullClassName .= $localClassName;
80
81        return $fullClassName;
82    }
83
84}