/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

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