Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Removed redundant count array items checks
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbundyra committed Sep 5, 2017
1 parent 37e39bc commit fd24165
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ConfigResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,8 @@ public function replaceKey($keys, $value, array $config)

$key = array_shift($keys);

$haveKeys = (count($keys) > 0) ? true : false;

// If no more keys, overwrite and return
if (! $haveKeys) {
if (! $keys) {
$config[$key] = $value;
return $config;
}
Expand Down Expand Up @@ -303,7 +301,7 @@ public function createNestedKeyValuePair(&$patchValues, $key, $value)
protected function extractAndSet(array $keys, $value, &$array)
{
$key = array_shift($keys);
if (count($keys)) {
if ($keys) {
if (! isset($array[$key]) || ! is_array($array[$key])) {
$array[$key] = [];
}
Expand All @@ -327,7 +325,7 @@ protected function deleteByKey(&$array, array $keys)
return;
}

if (1 > count($keys)) {
if (! $keys) {
unset($array[$key]);
return;
}
Expand Down

0 comments on commit fd24165

Please sign in to comment.