Skip to content

Commit

Permalink
Condense multi isset calls
Browse files Browse the repository at this point in the history
  • Loading branch information
bcrowe committed Dec 2, 2015
1 parent 96994b5 commit 3650ecb
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/I18n/Formatter/IcuFormatter.php
Expand Up @@ -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']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Mailer/Transport/SmtpTransport.php
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/Network/Request.php
Expand Up @@ -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'];
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Association/SelectableAssociationTrait.php
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Query.php
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Routing/Route/PluginShortRoute.php
Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion src/Template/Element/exception_stack_trace.ctp
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Validation/Validation.php
Expand Up @@ -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);
Expand Down

0 comments on commit 3650ecb

Please sign in to comment.