/** * @param string|PyStringNode|TableNode $data * * @throws \InvalidArgumentException * * @return array */ protected function getJsonData($data) { $json = null; if ($data instanceof PyStringNode) { $json = json_decode($data->getRaw(), true); } if ($data instanceof TableNode) { $json = $data->getRowsHash(); } if (is_string($data)) { $json = json_decode($data, true); } if (null === $json) { throw new \InvalidArgumentException(sprintf('Invalid json data class ("%s")', get_class($data))); } return $json; }