From 30c65f4a23ddbe9bd753d221068b8f300454cc5a Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 26 Aug 2014 10:36:53 +0200 Subject: [PATCH] simpler short conditionnal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to TRUE, and expr3 otherwise.” http://php.net/manual/en/language.operators.comparison.php --- app/controllers/ClientController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/ClientController.php b/app/controllers/ClientController.php index 10f427c1010a..a01c93d40e6a 100755 --- a/app/controllers/ClientController.php +++ b/app/controllers/ClientController.php @@ -207,11 +207,11 @@ class ClientController extends \BaseController { $client->city = trim(Input::get('city')); $client->state = trim(Input::get('state')); $client->postal_code = trim(Input::get('postal_code')); - $client->country_id = Input::get('country_id') ? Input::get('country_id') : null; + $client->country_id = Input::get('country_id') ? : null; $client->private_notes = trim(Input::get('private_notes')); - $client->size_id = Input::get('size_id') ? Input::get('size_id') : null; - $client->industry_id = Input::get('industry_id') ? Input::get('industry_id') : null; - $client->currency_id = Input::get('currency_id') ? Input::get('currency_id') : 1; + $client->size_id = Input::get('size_id') ? : null; + $client->industry_id = Input::get('industry_id') ? : null; + $client->currency_id = Input::get('currency_id') ? : 1; $client->payment_terms = Input::get('payment_terms') ? : 0; $client->website = trim(Input::get('website'));