Continued:
[core.git] / framework / main / interfaces / response / class_Responseable.php
index dbd09ef8d7c4a80e89842d40e1bacc283d3ef39b..6c0290b7ff1f7a0440f9a73dc187fdf1e4943bf4 100644 (file)
@@ -1,16 +1,16 @@
 <?php
 // Own namespace
-namespace CoreFramework\Response;
+namespace Org\Mxchange\CoreFramework\Response;
 
 // Import framework stuff
-use CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 
 /**
  * An interface for responses
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -34,7 +34,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $status         New response status
         * @return      void
         */
-       function setResponseStatus ($status);
+       function setResponseStatus (string $status);
 
        /**
         * Adds a header to the response. This method "wraps" the direct header()
@@ -47,7 +47,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $value  Value of header element
         * @return      void
         */
-       function addHeader ($name, $value);
+       function addHeader (string $name, $value);
 
        /**
         * "Writes" data to the response body
@@ -55,7 +55,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $output         Output we shall sent in the HTTP response
         * @return      void
         */
-       function writeToBody ($output);
+       function writeToBody (string $output);
 
        /**
         * Flushs the cached HTTP response to the outer world
@@ -66,7 +66,7 @@ interface Responseable extends FrameworkInterface {
         * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
         *                                                                                                      already sent
         */
-       function flushBuffer ($force = FALSE);
+       function flushBuffer (bool $force = false);
 
        /**
         * Adds a fatal message id to the response. The added messages can then be
@@ -75,7 +75,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $messageId      The message id we shall add
         * @return      void
         */
-       function addFatalMessage ($messageId);
+       function addFatalMessage (string $messageId);
 
        /**
         * Adds a cookie to the response
@@ -83,10 +83,11 @@ interface Responseable extends FrameworkInterface {
         * @param       $cookieName             Cookie's name
         * @param       $cookieValue    Value to store in the cookie
         * @param       $encrypted              Do some extra encryption on the value
+        * @param       $expires                Timestamp of expiration (default: configured)
         * @return      void
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         */
-       function addCookie ($cookieName, $cookieValue, $encrypted = FALSE);
+       function addCookie (string $cookieName, $cookieValue, bool $encrypted = FALSE, int $expires = NULL);
 
        /**
         * Redirect to a configured URL. The URL can be absolute or relative. In
@@ -97,7 +98,7 @@ interface Responseable extends FrameworkInterface {
         * @return      void
         * @throws      ResponseHeadersAlreadySentException             If headers are already sent
         */
-       function redirectToConfiguredUrl ($configEntry);
+       function redirectToConfiguredUrl (string $configEntry);
 
        /**
         * Expires the given cookie if it is set
@@ -105,7 +106,7 @@ interface Responseable extends FrameworkInterface {
         * @param       $cookieName             Cookie to expire
         * @return      void
         */
-       function expireCookie ($cookieName);
+       function expireCookie (string $cookieName);
 
        /**
         * Refreshs a given cookie. This will make the cookie live longer
@@ -113,6 +114,6 @@ interface Responseable extends FrameworkInterface {
         * @param       $cookieName             Cookie to refresh
         * @return      void
         */
-       function refreshCookie ($cookieName);
+       function refreshCookie (string $cookieName);
 
 }