PageRenderTime 57ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/zf2/vendor/Zend/Tool/Project/Context/Content/Engine/Phtml.php

http://github.com/eryx/php-framework-benchmark
PHP | 94 lines | 25 code | 10 blank | 59 comment | 0 complexity | 1488311c6a9cb8e2be1955bd96b7b6d0 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. */
  21. /**
  22. * @namespace
  23. */
  24. namespace Zend\Tool\Project\Context\Content\Engine;
  25. use Zend\Tool\Project\Context;
  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. class Phtml
  38. {
  39. /**
  40. * @var \Zend\Tool\Framework\Client\Storage
  41. */
  42. protected $_storage = null;
  43. /**
  44. * @var string
  45. */
  46. protected $_contentPrefix = null;
  47. /**
  48. * __construct()
  49. *
  50. * @param \Zend\Tool\Framework\Client\Storage $storage
  51. * @param string $contentPrefix
  52. */
  53. public function __construct(\Zend\Tool\Framework\Client\Storage $storage, $contentPrefix)
  54. {
  55. $this->_storage = $storage;
  56. $this->_contentPrefix = $contentPrefix;
  57. }
  58. /**
  59. * hasContext()
  60. *
  61. * @param \Zend\Tool\Project\Context $context
  62. * @param string $method
  63. * @return string
  64. */
  65. public function hasContent(Context $context, $method)
  66. {
  67. return $this->_storage->has($this->_contentPrefix . '/' . $context . '/' . $method . '.phtml');
  68. }
  69. /**
  70. * getContent()
  71. *
  72. * @param \Zend\Tool\Project\Context $context
  73. * @param string $method
  74. * @param mixed $parameters
  75. */
  76. public function getContent(Context $context, $method, $parameters)
  77. {
  78. $streamUri = $this->_storage->getStreamUri($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.phtml');
  79. ob_start();
  80. include $streamUri;
  81. $content = ob_get_clean();
  82. return $content;
  83. }
  84. }