Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 4e937db

Browse files
committed
Remove optional parameter in encodeAsObject
1 parent 745eef4 commit 4e937db

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Builder/Encoder/OperatorEncoder.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ public function encode(mixed $value): stdClass
4646
return $this->encodeAsArray($value);
4747

4848
case Encode::Object:
49-
return $this->encodeAsObject($value);
50-
5149
case Encode::FlatObject:
52-
return $this->encodeAsObject($value, true);
50+
return $this->encodeAsObject($value);
5351

5452
case Encode::DollarObject:
5553
return $this->encodeAsDollarObject($value);
@@ -98,7 +96,7 @@ private function encodeAsGroup(GroupStage $value): stdClass
9896
return $this->wrap($value, $result);
9997
}
10098

101-
private function encodeAsObject(OperatorInterface $value, bool $flat = false): stdClass
99+
private function encodeAsObject(OperatorInterface $value): stdClass
102100
{
103101
$result = new stdClass();
104102
foreach (get_object_vars($value) as $key => $val) {
@@ -110,7 +108,7 @@ private function encodeAsObject(OperatorInterface $value, bool $flat = false): s
110108
$result->{$key} = $this->recursiveEncode($val);
111109
}
112110

113-
return $flat
111+
return $value::ENCODE === Encode::FlatObject
114112
? $result
115113
: $this->wrap($value, $result);
116114
}

0 commit comments

Comments
 (0)