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