private function storeProperty(Property $property)
{
$path = $property->getPath();
$typeid = $property->getType();
$nativeValue = $property->getValueForStorage();
if ($typeid === PropertyType::STRING) {
foreach ((array) $nativeValue as $string) {
if (!$this->isStringValid($string)) {
throw new ValueFormatException('Invalid character found in property "' . $property->getName() . '". Are you passing a valid string?');
}
}
}
$value = $this->propertyToJsopString($property);
if (!$value) {
$this->setJsopBody($nativeValue, $path, $typeid);
if (is_array($nativeValue)) {
$this->setJsopBody('^' . $path . ' : []');
} else {
$this->setJsopBody('^' . $path . ' : ');
}
} else {
$encoded = json_encode($value);
if (PropertyType::DOUBLE == $property->getType() && !strpos($encoded, '.')) {
$encoded .= '.0';
}
$this->setJsopBody('^' . $path . ' : ' . $encoded);
}
}