Skip to content

Commit 56c01b8

Browse files
committed
[Serializer] Remove private function
1 parent 58a7f46 commit 56c01b8

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

src/Symfony/Component/Serializer/Encoder/CsvEncoder.php

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -189,32 +189,12 @@ private function flatten(array $array, array &$result, $keySeparator, $parentKey
189189
if (\is_array($value)) {
190190
$this->flatten($value, $result, $keySeparator, $parentKey.$key.$keySeparator);
191191
} else {
192-
$result[$parentKey.$key] = $this->cleanValueByType($value);
192+
// Ensures an actual value is used when dealing with true and false
193+
$result[$parentKey.$key] = false === $value ? 0 : (true === $value ? 1 : $value);
193194
}
194195
}
195196
}
196197

197-
/**
198-
* Ensures an actual value is used instead of a blank value when dealing
199-
* with true and false.
200-
*
201-
* @param string $value
202-
*
203-
* @return int
204-
*/
205-
private function cleanValueByType($value)
206-
{
207-
if (false === $value) {
208-
return 0;
209-
}
210-
211-
if (true === $value) {
212-
return 1;
213-
}
214-
215-
return $value;
216-
}
217-
218198
private function getCsvOptions(array $context)
219199
{
220200
$delimiter = isset($context[self::DELIMITER_KEY]) ? $context[self::DELIMITER_KEY] : $this->delimiter;

0 commit comments

Comments
 (0)