Esempio n. 1
0
 /**
  * @param string $json A JSON-encoded DataValue
  *
  * @throws UsageException
  * @throws LogicException
  * @return DataValue
  */
 private function decodeDataValue($json)
 {
     $data = json_decode($json, true);
     if (!is_array($data)) {
         $this->errorReporter->dieError('Failed to decode datavalue', 'baddatavalue');
     }
     try {
         $value = $this->dataValueFactory->newFromArray($data);
         return $value;
     } catch (IllegalValueException $ex) {
         $this->errorReporter->dieException($ex, 'baddatavalue');
     }
     throw new LogicException('ApiErrorReporter::dieException did not throw a UsageException');
 }