3 namespace CoreFramework\Output\;
5 // Import framework stuff
6 use CoreFramework\Generic\UnsupportedOperationException;
11 * @author Roland Haeder <webmaster@shipsimu.org>
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
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.
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.
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/>.
30 class ???Output extends BaseOutput implements OutputStreamer, Registerable {
32 * The instance for the singleton design pattern
34 private static $!!!Instance = NULL;
37 * Protected constructor
41 protected function __construct () {
42 // Call parent constructor
43 parent::__construct(__CLASS__);
47 * Create a new !!! output system and set the content type
49 * @param $applicationInstance An instance of a ManageableApplication class
50 * @return $debugInstance An instance of this middleware class
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();
58 // Get the content type
59 $contentType = self::$!!!Instance->getConfigInstance()->getConfigEntry('!!!_content_type');
61 // Set the content type
62 if (!empty($contentType)) {
64 $applicationInstance->getResponseInstance()->addHeader('Content-type', $contentType);
69 return self::$!!!Instance;
75 * @param $outStream Stream to output
76 * @param $stripTags Whether HTML tags shall be stripped out
80 public final function output ($outStream = false, $stripTags = false) {
81 $this->partialStub('Please implement this method. outStream()=' . strlen($outStream) . ',stripTags=' . intval($stripTags));
85 * Determines seek position
87 * @return $seekPosition Current seek position
88 * @throws UnsupportedOperationException If this method is called
90 public function determineSeekPosition () {
91 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
95 * Seek to given offset (default) or other possibilities as fseek() gives.
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
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);
110 * @return $size Size (in bytes) of file
111 * @throws UnsupportedOperationException If this method is called
113 public function size () {
114 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);