Continued with renaming-season:
[core.git] / framework / main / classes / output / class_
1 <?php
2 /**
3  * A ??? output class
4  *
5  * @author              Roland Haeder <webmaster@shipsimu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.shipsimu.org
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 class ???Output extends BaseOutput implements OutputStreamer, Registerable {
25         /**
26          * The instance for the singleton design pattern
27          */
28         private static $!!!Instance = NULL;
29
30         /**
31          * Protected constructor
32          *
33          * @return      void
34          */
35         protected function __construct () {
36                 // Call parent constructor
37                 parent::__construct(__CLASS__);
38         }
39
40         /**
41          * Create a new !!! output system and set the content type
42          *
43          * @param       $applicationInstance    An instance of a ManageableApplication class
44          * @return      $debugInstance                  An instance of this middleware class
45          */
46         public static final function createWebOutput (ManageableApplication $applicationInstance) {
47                 // Is the self-instance already set?
48                 if (is_null(self::$!!!Instance)) {
49                         // Get a new instance and set it
50                         self::$!!!Instance = new WebOutput();
51
52                         // Get the content type
53                         $contentType = self::$!!!Instance->getConfigInstance()->getConfigEntry('!!!_content_type');
54
55                         // Set the content type
56                         if (!empty($contentType)) {
57                                 // Set the header
58                                 $applicationInstance->getResponseInstance()->addHeader('Content-type', $contentType);
59                         } // END - if
60                 } // END - if
61
62                 // Return instance
63                 return self::$!!!Instance;
64         }
65
66         /**
67          * Output the code
68          *
69          * @param       $outStream      Stream to output
70          * @param       $stripTags      Whether HTML tags shall be stripped out
71          * @return      void
72          * @todo        0% done
73          */
74         public final function output ($outStream = FALSE, $stripTags = FALSE) {
75                 $this->partialStub('Please implement this method. outStream()=' . strlen($outStream) . ',stripTags=' . intval($stripTags));
76         }
77
78         /**
79          * Determines seek position
80          *
81          * @return      $seekPosition   Current seek position
82          * @throws      UnsupportedOperationException   If this method is called
83          */
84         public function determineSeekPosition () {
85                 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
86         }
87
88         /**
89          * Seek to given offset (default) or other possibilities as fseek() gives.
90          *
91          * @param       $offset         Offset to seek to (or used as "base" for other seeks)
92          * @param       $whence         Added to offset (default: only use offset to seek to)
93          * @return      $status         Status of file seek: 0 = success, -1 = failed
94          * @throws      UnsupportedOperationException   If this method is called
95          */
96         public function seek ($offset, $whence = SEEK_SET) {
97                 self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] offset=' . $offset . ',whence=' . $whence);
98                 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
99         }
100
101         /**
102          * Size of file stack
103          *
104          * @return      $size   Size (in bytes) of file
105          * @throws      UnsupportedOperationException   If this method is called
106          */
107         public function size () {
108                 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
109         }
110 }
111
112 // [EOF]
113 ?>