File indexing completed on 2025-01-19 05:21:36
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 * @see Zend_Tool_Project_Context_Content_Engine_CodeGenerator 0025 */ 0026 // require_once 'Zend/Tool/Project/Context/Content/Engine/CodeGenerator.php'; 0027 0028 /** 0029 * @see Zend_Tool_Project_Context_Content_Engine_Phtml 0030 */ 0031 // require_once 'Zend/Tool/Project/Context/Content/Engine/Phtml.php'; 0032 0033 /** 0034 * This class is the front most class for utilizing Zend_Tool_Project 0035 * 0036 * A profile is a hierarchical set of resources that keep track of 0037 * items within a specific project. 0038 * 0039 * @category Zend 0040 * @package Zend_Tool 0041 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0042 * @license http://framework.zend.com/license/new-bsd New BSD License 0043 */ 0044 class Zend_Tool_Project_Context_Content_Engine 0045 { 0046 /** 0047 * @var Zend_Tool_Framework_Client_Storage 0048 */ 0049 protected $_storage = null; 0050 0051 /** 0052 * @var string 0053 */ 0054 protected $_keyInStorage = 'project/content'; 0055 0056 /** 0057 * @var array 0058 */ 0059 protected $_engines = array(); 0060 0061 /** 0062 * __construct() 0063 * 0064 * @param Zend_Tool_Framework_Client_Storage $storage 0065 */ 0066 public function __construct(Zend_Tool_Framework_Client_Storage $storage) 0067 { 0068 $this->_storage = $storage; 0069 $this->_engines = array( 0070 new Zend_Tool_Project_Context_Content_Engine_CodeGenerator($storage, $this->_keyInStorage), 0071 new Zend_Tool_Project_Context_Content_Engine_Phtml($storage, $this->_keyInStorage), 0072 ); 0073 } 0074 0075 /** 0076 * getContent() 0077 * 0078 * @param Zend_Tool_Project_Context_Interface $context 0079 * @param string $methodName 0080 * @param mixed $parameters 0081 * @return string 0082 */ 0083 public function getContent(Zend_Tool_Project_Context_Interface $context, $methodName, $parameters) 0084 { 0085 $content = null; 0086 0087 foreach ($this->_engines as $engine) { 0088 if ($engine->hasContent($context, $methodName, $parameters)) { 0089 $content = $engine->getContent($context, $methodName, $parameters); 0090 0091 if ($content != null) { 0092 break; 0093 } 0094 0095 } 0096 0097 } 0098 0099 if ($content == null) { 0100 return false; 0101 } 0102 0103 return $content; 0104 } 0105 0106 }