aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexis von Glasow <vonglasow@gmail.com>2013-10-17 13:29:04 +0200
committerAlexis von Glasow <vonglasow@gmail.com>2013-10-18 13:56:55 +0200
commitc87db2aeaf2f2478f4009785668f7cfb2954095c (patch)
tree27c367b2e05fc419de99ed2db0d2e18b028d890e
parent01bb48ff8e7dd77fe851f3d82304eb03f8bb72b7 (diff)
downloadRouter-c87db2aeaf2f2478f4009785668f7cfb2954095c.zip
Router-c87db2aeaf2f2478f4009785668f7cfb2954095c.tar.gz
Router-c87db2aeaf2f2478f4009785668f7cfb2954095c.tar.bz2
Add constant to have explicit option for (set|get)DefaultPort
-rw-r--r--Http.php22
1 files changed, 18 insertions, 4 deletions
diff --git a/Http.php b/Http.php
index 47539ff..cb6492f 100644
--- a/Http.php
+++ b/Http.php
@@ -75,6 +75,20 @@ namespace Hoa\Router {
class Http extends Generic implements \Hoa\Core\Parameter\Parameterizable {
/**
+ * Connection unsecure
+ *
+ * @const boolean
+ */
+ const UNSECURE = false;
+
+ /**
+ * Connection secure
+ *
+ * @const boolean
+ */
+ const SECURE = true;
+
+ /**
* Parameters.
*
* @var \Hoa\Core\Parameter object
@@ -886,9 +900,9 @@ class Http extends Generic implements \Hoa\Core\Parameter\Parameterizable {
* @param bool $secure Whether the connection is secured.
* @return int
*/
- public function setDefaultPort ( $port, $secure = false ) {
+ public function setDefaultPort ( $port, $secure = self::UNSECURE ) {
- if(false === $secure) {
+ if(static::UNSECURE === $secure) {
$old = $this->_httpPort;
$this->_httpPort = $port;
@@ -909,9 +923,9 @@ class Http extends Generic implements \Hoa\Core\Parameter\Parameterizable {
* @param bool $secure Whether the connection is secured.
* @return int
*/
- public function getDefaultPort ( $secure = false ) {
+ public function getDefaultPort ( $secure = self::UNSECURE ) {
- if(false === $secure)
+ if(static::UNSECURE === $secure)
return $this->_httpPort;
return $this->_httpsPort;