From 7e3298753a9f93405ef44b46ba4db4ca98553b51 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 14 Nov 2015 04:08:07 -0500
Subject: [PATCH] Use ternary operator where aplicable

---
 program/lib/Roundcube/rcube.php |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index a1773a8..3b17d99 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -505,7 +505,7 @@
         }
 
         ini_set('session.cookie_secure', $is_secure);
-        ini_set('session.name', $sess_name ? $sess_name : 'roundcube_sessid');
+        ini_set('session.name', $sess_name ?: 'roundcube_sessid');
         ini_set('session.use_cookies', 1);
         ini_set('session.use_only_cookies', 1);
         ini_set('session.cookie_httponly', 1);
@@ -601,7 +601,7 @@
             $attrib = array('name' => $attrib);
         }
 
-        $name = $attrib['name'] ? $attrib['name'] : '';
+        $name = (string) $attrib['name'];
 
         // attrib contain text values: use them from now
         if (($setval = $attrib[strtolower($_SESSION['language'])]) || ($setval = $attrib['en_us'])) {
@@ -619,7 +619,7 @@
         // replace vars in text
         if (is_array($attrib['vars'])) {
             foreach ($attrib['vars'] as $var_key => $var_value) {
-                $text = str_replace($var_key[0]!='$' ? '$'.$var_key : $var_key, $var_value, $text);
+                $text = str_replace($var_key[0] != '$' ? '$'.$var_key : $var_key, $var_value, $text);
             }
         }
 
@@ -685,7 +685,7 @@
      */
     public function load_language($lang = null, $add = array(), $merge = array())
     {
-        $lang = $this->language_prop(($lang ? $lang : $_SESSION['language']));
+        $lang = $this->language_prop($lang ?: $_SESSION['language']);
 
         // load localized texts
         if (empty($this->texts) || $lang != $_SESSION['language']) {
@@ -1267,7 +1267,7 @@
      */
     public static function log_bug($arg_arr)
     {
-        $program = strtoupper(!empty($arg_arr['type']) ? $arg_arr['type'] : 'php');
+        $program = strtoupper($arg_arr['type'] ?: 'php');
         $level   = self::get_instance()->config->get('debug_level');
 
         // disable errors for ajax requests, write to log instead (#1487831)

--
Gitblit v1.9.1