<?php /** * @see https://github.com/zendframework/zend-config for the canonical source repository * @copyright Copyright (c) 2005-2017 Zend Technologies USA Inc. (http://www.zend.com) * @license https://github.com/zendframework/zend-config/blob/master/LICENSE.md New BSD License */ namespace Zend\Config\Writer; use Zend\Config\Exception; class Json extends AbstractWriter { /** * processConfig(): defined by AbstractWriter. * * @param array $config * @return string * @throws Exception\RuntimeException if encoding errors occur. */ public function processConfig(array $config) { $serialized = json_encode($config, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); if (false === $serialized) { throw new Exception\RuntimeException(json_last_error_msg()); } return $serialized; } }