public function CSV::decode in Apigee Edge 8
Decodes field data from the target format.
Parameters
string $data: Encoded data.
Return value
array Decoded data.
Overrides FieldStorageFormatInterface::decode
File
- src/
Plugin/ ApigeeFieldStorageFormat/ CSV.php, line 67
Class
- CSV
- CSV formatter for Apigee Edge field storage.
Namespace
Drupal\apigee_edge\Plugin\ApigeeFieldStorageFormatCode
public function decode(string $data) : array {
$data = trim($data) . PHP_EOL;
$values = $this
->readCommaSeparatedValues($data);
$result = [];
$it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($values));
foreach ($it as $v) {
$result[] = [
'value' => $v,
];
}
return $result;
}