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