Permalink
Browse files

Merge pull request #165 from carusogabriel/null-coalesce-operator

Use Null Coalesce Operator
  • Loading branch information...
mikey179 committed Dec 28, 2017
2 parents 78a193c + 0fa0251 commit 8f11a4175cbc21e468705f563ba681249c50d862
@@ -116,11 +116,7 @@ protected function doRead(int $offset, int $count): string
$result = '';
for ($i = 0; $i < $count; $i++) {
- if (isset($this->content[$i + $offset])) {
- $result .= $this->content[$i + $offset];
- } else {
- $result .= ' ';
- }
+ $result .= $this->content[$i + $offset] ?? ' ';
}
return $result;
@@ -519,8 +519,8 @@ public function stream_metadata(string $path, int $option, $var): bool
}
$currentTime = time();
- $content->lastModified(((isset($var[0])) ? ($var[0]) : ($currentTime)))
- ->lastAccessed(((isset($var[1])) ? ($var[1]) : ($currentTime)));
+ $content->lastModified($var[0] ?? $currentTime)
+ ->lastAccessed($var[1] ?? $currentTime);
return true;
case STREAM_META_OWNER_NAME:

0 comments on commit 8f11a41

Please sign in to comment.