Skip to content

Commit

Permalink
[Serializer] Remove private function
Browse files Browse the repository at this point in the history
  • Loading branch information
battye committed Jun 14, 2019
1 parent 58a7f46 commit 56c01b8
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/Symfony/Component/Serializer/Encoder/CsvEncoder.php
Expand Up @@ -189,32 +189,12 @@ private function flatten(array $array, array &$result, $keySeparator, $parentKey
if (\is_array($value)) {
$this->flatten($value, $result, $keySeparator, $parentKey.$key.$keySeparator);
} else {
$result[$parentKey.$key] = $this->cleanValueByType($value);
// Ensures an actual value is used when dealing with true and false
$result[$parentKey.$key] = false === $value ? 0 : (true === $value ? 1 : $value);
}
}
}

/**
* Ensures an actual value is used instead of a blank value when dealing
* with true and false.
*
* @param string $value
*
* @return int
*/
private function cleanValueByType($value)
{
if (false === $value) {
return 0;
}

if (true === $value) {
return 1;
}

return $value;
}

private function getCsvOptions(array $context)
{
$delimiter = isset($context[self::DELIMITER_KEY]) ? $context[self::DELIMITER_KEY] : $this->delimiter;
Expand Down

0 comments on commit 56c01b8

Please sign in to comment.