3 namespace Org\Mxchange\CoreFramework\Output\Debug;
5 // Import framework stuff
6 use Org\Mxchange\CoreFramework\Debug\Debugger;
7 use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
8 use Org\Mxchange\CoreFramework\Output\Debug\BaseDebugOutput;
9 use Org\Mxchange\CoreFramework\Stream\Output\OutputStreamer;
12 * A debug output class for the web browser
14 * @author Roland Haeder <webmaster@shipsimu.org>
16 <<<<<<< HEAD:framework/main/classes/output/debug/web/class_DebugWebOutput.php
17 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
19 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
20 >>>>>>> Some updates::inc/main/classes/output/debug/web/class_DebugWebOutput.php
21 * @license GNU GPL 3.0 or any newer version
22 * @link http://www.shipsimu.org
24 * This program is free software: you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation, either version 3 of the License, or
27 * (at your option) any later version.
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with this program. If not, see <http://www.gnu.org/licenses/>.
37 class DebugWebOutput extends BaseDebugOutput implements Debugger, OutputStreamer {
39 * Protected constructor
43 protected function __construct () {
44 // Call parent constructor
45 parent::__construct(__CLASS__);
49 * Creates an instance of this class
51 * @return $debugInstance The prepared debug instance
53 public static final function createDebugWebOutput () {
55 $debugInstance = new DebugWebOutput();
58 return $debugInstance;
62 * Outputs the given data directly, ignores $stripTags
64 * @param $output The HTML output
65 * @param $stripTags Whether HTML tags shall be stripped out
68 public final function outputStream ($output, $stripTags = false) {
70 $output = str_replace('<br />', '', $output);
71 print(stripslashes($output)."<br />\n");
77 * @param $outStream Stream to output
78 * @param $stripTags Whether HTML tags shall be stripped out
81 public final function output ($outStream = false, $stripTags = false) {
82 // Empty output will be silently ignored
83 if ($outStream !== false) {
84 $this->outputStream($outStream, $stripTags);
89 * Streams the data and maybe does something to it
91 * @param $data The data (string mostly) to "stream"
92 * @return $data The data (string mostly) to "stream"
93 * @throws UnsupportedOperationException If this method is called
95 public function streamData ($data) {
96 self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.');
97 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
101 * Determines seek position
103 * @return $seekPosition Current seek position
104 * @throws UnsupportedOperationException If this method is called
106 public function determineSeekPosition () {
107 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
111 * Seek to given offset (default) or other possibilities as fseek() gives.
113 * @param $offset Offset to seek to (or used as "base" for other seeks)
114 * @param $whence Added to offset (default: only use offset to seek to)
115 * @return $status Status of file seek: 0 = success, -1 = failed
116 * @throws UnsupportedOperationException If this method is called
118 public function seek ($offset, $whence = SEEK_SET) {
119 self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] offset=' . $offset . ',whence=' . $whence);
120 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
126 * @return $size Size (in bytes) of file
127 * @throws UnsupportedOperationException If this method is called
129 public function size () {
130 throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);