From fc42cc50661cf4a25fef48613401fe17e7aa8f7a Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Sun, 27 Feb 2011 18:28:11 +0100 Subject: [PATCH] [HttpFoundation] Removed useless else --- .../Component/HttpFoundation/File/File.php | 8 +++---- .../Component/HttpFoundation/HeaderBag.php | 8 +++---- .../Component/HttpFoundation/Request.php | 4 ++-- .../SessionStorage/PdoSessionStorage.php | 22 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/File/File.php b/src/Symfony/Component/HttpFoundation/File/File.php index 306764f932..e88d915d06 100644 --- a/src/Symfony/Component/HttpFoundation/File/File.php +++ b/src/Symfony/Component/HttpFoundation/File/File.php @@ -519,9 +519,9 @@ class File { if ($ext = pathinfo($this->getName(), \PATHINFO_EXTENSION)) { return '.' . $ext; - } else { - return ''; } + + return ''; } /** @@ -537,9 +537,9 @@ class File if (isset(self::$defaultExtensions[$type])) { return '.' . self::$defaultExtensions[$type]; - } else { - return $this->getExtension(); } + + return $this->getExtension(); } /** diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index f28620b8df..c786753c6a 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -96,16 +96,16 @@ class HeaderBag if (!array_key_exists($key, $this->headers)) { if (null === $default) { return $first ? null : array(); - } else { - return $first ? $default : array($default); } + + return $first ? $default : array($default); } if ($first) { return count($this->headers[$key]) ? $this->headers[$key][0] : $default; - } else { - return $this->headers[$key]; } + + return $this->headers[$key]; } /** diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 57883272c4..f9de1cba51 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -436,9 +436,9 @@ class Request if (('http' == $scheme && $port == 80) || ('https' == $scheme && $port == 443)) { return $name; - } else { - return $name.':'.$port; } + + return $name.':'.$port; } public function getRequestUri() diff --git a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php index 348ba170ad..3ff7cb3637 100644 --- a/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php @@ -171,18 +171,18 @@ class PdoSessionStorage extends NativeSessionStorage if (count($sessionRows) == 1) { return $sessionRows[0][0]; - } else { - // session does not exist, create it - $sql = 'INSERT INTO '.$db_table.'('.$db_id_col.', '.$db_data_col.', '.$db_time_col.') VALUES (?, ?, ?)'; - - $stmt = $this->db->prepare($sql); - $stmt->bindParam(1, $id, \PDO::PARAM_STR); - $stmt->bindValue(2, '', \PDO::PARAM_STR); - $stmt->bindValue(3, time(), \PDO::PARAM_INT); - $stmt->execute(); - - return ''; } + + // session does not exist, create it + $sql = 'INSERT INTO '.$db_table.'('.$db_id_col.', '.$db_data_col.', '.$db_time_col.') VALUES (?, ?, ?)'; + + $stmt = $this->db->prepare($sql); + $stmt->bindParam(1, $id, \PDO::PARAM_STR); + $stmt->bindValue(2, '', \PDO::PARAM_STR); + $stmt->bindValue(3, time(), \PDO::PARAM_INT); + $stmt->execute(); + + return ''; } catch (\PDOException $e) { throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e); }