Skip to content

Commit 995c65c

Browse files
committed
replaced count(x) == 0 to empty
1 parent 0fbcacc commit 995c65c

File tree

6 files changed

+8
-12
lines changed

6 files changed

+8
-12
lines changed

CHANGES.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
- Removed unused logic for HTTP and requests dependency.
33
- Removed all producer logic for Storages.
44
- Added SafeRedisWrapper for handling exception in Redis.
5-
- Fixed typos in bucket and CONTRIBUTORS-GUIDE.
6-
- Added `.gitattributes` for excluding tests/.
5+
- Added `.gitattributes` for excluding `tests/.` and other files for composer package.
6+
- Fixed typos in `Splitter.php` and CONTRIBUTORS-GUIDE.
77

88
7.1.0 (Dec 3, 2021)
99
- Added a new option to use when running Redis in cluster mode called `keyHashTags` which receives a list of hashtags from which the SDK will randomly pick one to use on the generated instance.

src/SplitIO/Component/Cache/SplitCache.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ public function getChangeNumber()
4949
public function getSplit($splitName)
5050
{
5151
$cache = Di::getCache();
52-
$cacheItem = $cache->get(self::getCacheKeyForSplit($splitName));
53-
return $cacheItem;
52+
return $cache->get(self::getCacheKeyForSplit($splitName));
5453
}
5554

5655
/**

src/SplitIO/Component/Cache/Storage/Adapter/CacheStorageAdapterInterface.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
interface CacheStorageAdapterInterface
55
{
6-
7-
// public function __construct(array $options);
8-
96
/**
107
* @param null|string $pattern
118
* @return mixed

src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private function isValidConfigArray($nodes, $type)
4040
if (!is_array($nodes)) {
4141
return $type . "s must be an array.";
4242
}
43-
if (count($nodes) == 0) {
43+
if (empty($nodes)) {
4444
return "At least one " . $type . " is required.";
4545
}
4646
if (SplitIOUtils\isAssociativeArray($nodes)) {
@@ -119,7 +119,7 @@ function ($value) {
119119
return $this->validateKeyHashTag($value)['valid'];
120120
}
121121
);
122-
if (count($filteredArray) == 0) {
122+
if (empty($filteredArray)) {
123123
throw new AdapterException('keyHashTags size is zero after filtering valid elements.');
124124
}
125125
return $selected = $filteredArray[array_rand($filteredArray, 1)];
@@ -228,7 +228,7 @@ public function get($key)
228228
public function fetchMany(array $keys = array())
229229
{
230230
$toReturn = array();
231-
if (count($keys) == 0) {
231+
if (empty($keys)) {
232232
return $toReturn;
233233
}
234234
$values = $this->client->mget($keys);

src/SplitIO/Grammar/Condition/Matcher/PartOfSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function __construct($data, $negate = false, $attribute = null)
1818

1919
protected function evalKey($key)
2020
{
21-
if (!is_array($key) || count($key) == 0) {
21+
if (!is_array($key) || empty($key)) {
2222
return false;
2323
}
2424

src/SplitIO/Sdk/Validator/InputValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ function ($featureName) use ($operation) {
258258
)
259259
)
260260
);
261-
if (count($filteredArray) == 0) {
261+
if (empty($filteredArray)) {
262262
SplitApp::logger()->critical($operation . ': featureNames must be a non-empty array.');
263263
return null;
264264
}

0 commit comments

Comments
 (0)