Some updates:
[core.git] / framework / main / classes / response / console / class_ConsoleResponse.php
1 <?php
2 // Own namespace
3 namespace Org\Mxchange\CoreFramework\Response;
4
5 // Import framework stuff
6 use Org\Mxchange\CoreFramework\Response\Responseable;
7
8 /**
9  * A class for a console response aka output to console
10  *
11  * @author              Roland Haeder <webmaster@shipsimu.org>
12  * @version             0.0.0
13 <<<<<<< HEAD:framework/main/classes/response/console/class_ConsoleResponse.php
14  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
15 =======
16  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
17 >>>>>>> Some updates::inc/main/classes/response/console/class_ConsoleResponse.php
18  * @license             GNU GPL 3.0 or any newer version
19  * @link                http://www.shipsimu.org
20  *
21  * This program is free software: you can redistribute it and/or modify
22  * it under the terms of the GNU General Public License as published by
23  * the Free Software Foundation, either version 3 of the License, or
24  * (at your option) any later version.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29  * GNU General Public License for more details.
30  *
31  * You should have received a copy of the GNU General Public License
32  * along with this program. If not, see <http://www.gnu.org/licenses/>.
33  *
34  * The extended headers are taken from phpMyAdmin setup tool, written by
35  * Michal Cihar <michal@cihar.com>, licensed under GNU GPL 2.0.
36  */
37 class ConsoleResponse extends BaseResponse implements Responseable {
38         /**
39          * Protected constructor
40          *
41          * @return      void
42          */
43         protected function __construct () {
44                 // Call parent constructor
45                 parent::__construct(__CLASS__);
46
47                 // Set response type
48                 $this->setResponseType('console');
49         }
50
51         /**
52          * Creates an object of this class
53          *
54          * @return      $responseInstance       A prepared instance of this class
55          */
56         public static final function createConsoleResponse () {
57                 // Get a new instance
58                 $responseInstance = new ConsoleResponse();
59
60                 // Return the prepared instance
61                 return $responseInstance;
62         }
63
64         /**
65          * Initializes the template engine instance
66          *
67          * @param       $applicationInstance    An instance of a manageable application
68          * @return      void
69          */
70         public final function initTemplateEngine (ManageableApplication $applicationInstance) {
71                 $this->setTemplateInstance($this->prepareTemplateInstance($applicationInstance));
72         }
73
74         /**
75          * Adds a cookie to the response
76          *
77          * @param       $cookieName             Cookie's name
78          * @param       $cookieValue    Value to store in the cookie
79          * @param       $encrypted              Do some extra encryption on the value
80          * @param       $expires                Timestamp of expiration (default: configured)
81          * @return      void
82          * @throws      ResponseHeadersAlreadySentException             If headers are already sent
83          */
84         public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = NULL) {
85                 //* DEBUG: */ echo $cookieName.'='.$cookieValue."<br />\n";
86                 $this->partialStub('Naturally unimplemented in console response.');
87         }
88
89         /**
90          * Redirect to a configured URL. The URL can be absolute or relative. In
91          * case of relative URL it will be extended automatically.
92          *
93          * @param       $configEntry    The configuration entry which holds our URL
94          * @return      void
95          * @throws      ResponseHeadersAlreadySentException             If headers are already sent
96          */
97         public function redirectToConfiguredUrl ($configEntry) {
98                 $this->partialStub('Naturally unimplemented in console response.');
99         }
100
101         /**
102          * Expires the given cookie if it is set
103          *
104          * @param       $cookieName             Cookie to expire
105          * @return      void
106          */
107         public function expireCookie ($cookieName) {
108                 $this->partialStub('Naturally unimplemented in console response.');
109         }
110
111         /**
112          * Refreshs a given cookie. This will make the cookie live longer
113          *
114          * @param       $cookieName             Cookie to refresh
115          * @return      void
116          */
117         public function refreshCookie ($cookieName) {
118                 $this->partialStub('Naturally unimplemented in console response.');
119         }
120
121         /**
122          * Flushs the cached console response to the console
123          *
124          * @param       $force  Whether we shall force the output or abort if headers are
125          *                                      already sent with an exception
126          * @return      void
127          * @throws      ResponseHeadersAlreadySentException             Thrown if headers are already sent
128          */
129         public function flushBuffer ($force = false) {
130                 $this->partialStub('Please implement this class.');
131         }
132
133 }