Source for file Decorator.php

Documentation is available at Decorator.php

  1. <?php
  2.  
  3. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  4.  
  5. /**
  6. * ScriptReorganizer Type :: Decorator
  7. *
  8. * PHP version 5
  9. *
  10. * LICENSE: This library is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU Lesser General Public License as published by the Free
  12. * Software Foundation; either version 2.1 of the License, or (at your option) any
  13. * later version.
  14. *
  15. * @category Tools
  16. * @package ScriptReorganizer
  17. * @subpackage Type
  18. * @author Stefano F. Rausch <stefano@rausch-e.net>
  19. * @copyright 2005 Stefano F. Rausch <stefano@rausch-e.net>
  20. * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
  21. * @version SVN: $Id: Decorator.php 32 2005-10-30 22:05:19Z stefanorausch $
  22. * @link http://pear.php.net/package/ScriptReorganizer
  23. * @filesource
  24. */
  25.  
  26. /**
  27. * Extends <kbd>ScriptReorganizer_Type</kbd>
  28. */
  29. require_once 'ScriptReorganizer/Type.php';
  30.  
  31. /**
  32. * Base class to be extended by (type) decorators to apply
  33. *
  34. * All decorators must follow the naming convention
  35. * <kbd>ScriptReorganizer_Type_Decorator_<Decorator></kbd>.
  36. *
  37. * @category Tools
  38. * @package ScriptReorganizer
  39. * @subpackage Type
  40. * @author Stefano F. Rausch <stefano@rausch-e.net>
  41. * @copyright 2005 Stefano F. Rausch <stefano@rausch-e.net>
  42. * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
  43. * @version Release: 0.4.0
  44. * @link http://pear.php.net/package/ScriptReorganizer
  45. */
  46. abstract class ScriptReorganizer_Type_Decorator extends ScriptReorganizer_Type
  47. {
  48. // {{{ public function __construct( ScriptReorganizer_Type $type )
  49. /**
  50. * Constructor
  51. *
  52. * @param ScriptReorganizer_Type $type a <kbd>ScriptReorganizer_Type</kbd> to
  53. * decorate
  54. */
  55. public function __construct( ScriptReorganizer_Type $type )
  56. {
  57. $this->type = $type;
  58. }
  59. // }}}
  60. // {{{ public function __destruct()
  61. /**
  62. * Destructor
  63. */
  64. public function __destruct()
  65. {
  66. unset( $this->type );
  67. }
  68. // }}}
  69. // {{{ public function load( $file )
  70. /**
  71. * Loads the script's content to be reorganized from disk
  72. *
  73. * @param string $file a string representing the file's name to load
  74. * @return void
  75. * @throws {@link ScriptReorganizer_Type_Exception ScriptReorganizer_Type_Exception}
  76. */
  77. public function load( $file )
  78. {
  79. $this->type->load( $file );
  80. }
  81. // }}}
  82. // {{{ public function reformat()
  83. /**
  84. * Reorganizes the script's content by applying the chosen
  85. * {@link ScriptReorganizer_Strategy Strategy}
  86. *
  87. * @return void
  88. */
  89. public function reformat()
  90. {
  91. $this->type->reformat();
  92. }
  93. // }}}
  94. // {{{ public function save( $file )
  95. /**
  96. * Saves the reorganized script's content to disk
  97. *
  98. * @param string $file a string representing the file's name to save
  99. * @return void
  100. * @throws {@link ScriptReorganizer_Type_Exception ScriptReorganizer_Type_Exception}
  101. */
  102. public function save( $file )
  103. {
  104. $this->type->save( $file );
  105. }
  106. // }}}
  107. // {{{ package function _getContent()
  108. /**
  109. * Gets the script's content currently being reorganized
  110. *
  111. * @visibility package restricted
  112. * @return string a string representing the script's content
  113. */
  114. public function _getContent()
  115. {
  116. return $this->type->_getContent();
  117. }
  118. // }}}
  119. // {{{ package function _setContent( $content )
  120. /**
  121. * Sets the script's content currently being reorganized
  122. *
  123. * @visibility package restricted
  124. * @param string $content a string representing the content's replacement
  125. * @return void
  126. */
  127. public function _setContent( $content )
  128. {
  129. $this->type->_setContent( $content );
  130. }
  131. // }}}
  132. // {{{ private properties
  133. /**
  134. * Holds the type to decorate
  135. *
  136. * @var ScriptReorganizer_Type
  137. */
  138. private $type = null;
  139. // }}}
  140.  
  141. }
  142.  
  143. /*
  144. * Local variables:
  145. * tab-width: 4
  146. * c-basic-offset: 4
  147. * c-hanging-comment-ender-p: nil
  148. * End:
  149. */
  150.  
  151. ?>

Documentation generated on Tue, 22 Nov 2005 01:57:06 +0100 by phpDocumentor 1.3.0RC3