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