Skip to content
Permalink
Browse files

Condense multi isset calls

  • Loading branch information...
bcrowe committed Dec 2, 2015
1 parent 96994b5 commit 3650ecb5b1fd24157b20722ad64fdb18f3b28c17
@@ -51,7 +51,7 @@ public function format($locale, $message, array $vars)
return $this->_formatMessage($locale, $message, $vars);
}
if (isset($vars['_context']) && isset($message['_context'])) {
if (isset($vars['_context'], $message['_context'])) {
$message = $message['_context'][$vars['_context']];
unset($vars['_context']);
}
@@ -246,7 +246,7 @@ protected function _connect()
*/
protected function _auth()
{
if (isset($this->_config['username']) && isset($this->_config['password'])) {
if (isset($this->_config['username'], $this->_config['password'])) {
$replyCode = (string)$this->_smtpSend('AUTH LOGIN', '334|500|502|504');
if ($replyCode === '334') {
try {
@@ -332,7 +332,7 @@ protected static function _url($config)
} else {
$uri = substr($_SERVER['REQUEST_URI'], strlen(Configure::read('App.fullBaseUrl')));
}
} elseif (isset($_SERVER['PHP_SELF']) && isset($_SERVER['SCRIPT_NAME'])) {
} elseif (isset($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME'])) {
$uri = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['PHP_SELF']);
} elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
$uri = $_SERVER['HTTP_X_REWRITE_URL'];
@@ -828,7 +828,7 @@ public static function addDetector($name, $callable)
static::$_detectors[$name] = $callable;
return;
}
if (isset(static::$_detectors[$name]) && isset($callable['options'])) {
if (isset(static::$_detectors[$name], $callable['options'])) {
$callable = Hash::merge(static::$_detectors[$name], $callable);
}
static::$_detectors[$name] = $callable;
@@ -314,7 +314,7 @@ protected function _resultInjector($fetchQuery, $resultMap, $options)
$sourceKey = $sourceKeys[0];
return function ($row) use ($resultMap, $sourceKey, $nestKey) {
if (isset($row[$sourceKey]) && isset($resultMap[$row[$sourceKey]])) {
if (isset($row[$sourceKey], $resultMap[$row[$sourceKey]])) {
$row[$nestKey] = $resultMap[$row[$sourceKey]];
}
return $row;
@@ -632,7 +632,7 @@ public function applyOptions(array $options)
ksort($options);
foreach ($options as $option => $values) {
if (isset($valid[$option]) && isset($values)) {
if (isset($valid[$option], $values)) {
$this->{$valid[$option]}($values);
} else {
$this->_options[$option] = $values;
@@ -51,7 +51,7 @@ public function parse($url)
*/
public function match(array $url, array $context = [])
{
if (isset($url['controller']) && isset($url['plugin']) && $url['plugin'] !== $url['controller']) {
if (isset($url['controller'], $url['plugin']) && $url['plugin'] !== $url['controller']) {
return false;
}
$this->defaults['controller'] = $url['controller'];
@@ -21,7 +21,7 @@ use Cake\Error\Debugger;
foreach ($error->getTrace() as $i => $stack):
$excerpt = $params = [];
if (isset($stack['file']) && isset($stack['line'])):
if (isset($stack['file'], $stack['line'])):
$excerpt = Debugger::excerpt($stack['file'], $stack['line'], 4);
endif;
@@ -746,7 +746,7 @@ public static function range($check, $lower = null, $upper = null)
if ((float)$check != $check) {
return false;
}
if (isset($lower) && isset($upper)) {
if (isset($lower, $upper)) {
return ($check >= $lower && $check <= $upper);
}
return is_finite($check);

0 comments on commit 3650ecb

Please sign in to comment.
You can’t perform that action at this time.