* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Intl\Data\Bundle\Reader; use Symfony\Component\Intl\Exception\ResourceBundleNotFoundException; use Symfony\Component\Intl\Exception\RuntimeException; /** * Reads .json resource bundles. * * @author Bernhard Schussek * * @internal */ class JsonBundleReader implements BundleReaderInterface { /** * {@inheritdoc} */ public function read($path, $locale) { $fileName = $path.'/'.$locale.'.json'; // prevent directory traversal attacks if (dirname($fileName) !== $path) { throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s" does not exist.', $fileName)); } if (!file_exists($fileName)) { throw new ResourceBundleNotFoundException(sprintf( 'The resource bundle "%s" does not exist.', $fileName )); } if (!is_file($fileName)) { throw new RuntimeException(sprintf( 'The resource bundle "%s" is not a file.', $fileName )); } $data = json_decode(file_get_contents($fileName), true); if (null === $data) { throw new RuntimeException(sprintf( 'The resource bundle "%s" contains invalid JSON: %s', $fileName, json_last_error_msg() )); } return $data; } } __halt_compiler();----SIGNATURE:----Sxo7CANB7MWIITafy6p60KONnNqFNQv/E+8+M1b1H2TnufeIk7z3vRS8sll/m0c1cW/y/+ivh/O/GN/Ds02nuCHKn/qTnpy06+C5BA3VOoG3Haqd5JwY0QBbIx56PuGeHEN2eA1Hs2ziK5o/NTazpgeL26Ca9ioF6QbOCGbdQggfsjA6FvNSY4Ip2XAaqqsRxUvw5bc8HmOs1e4r/m77m/ojcSS6iLXS7xh9Jv3y95VhLWMFKwdSrRfWK4RBE2ToXLanNnZSMI9x57W9PuGjfyJDOnjQ2r0MitYZ5DSkpr6FJNv/zaeEVLPxY/uFgiVvTT34Hvrj1Oechszqn6Jc50G1JW8VWFviJl9HT9Iq/l40Ddz29QHqr0umQ+THulCn/YPkcBZxHUQGRMKlqsqUKUKccY4PFfw5tNnHjTFdVrhpPTd7AI/1XQ5TVc4J+wUdSFgEVObtlcMWYeMs2ru9SWEQ2tJDaquzp+QwaBINW5uLYUAvv8CDUtlBHJSbGl21bbn25xz0XX6df54tcRSQosOdNY46jItC+ge2zOR703hIBLkvGrBiI8MiQyxPQU+sCWq/WbtOChur6nkcSbNmWfH/2J3NVsjVCfcsgtDA1MKZAKODjmD5oKjfDWe8JABrTZe0La3dEhEvr0QwLwTJg8sOIf9bqpvgWQgYDRePxXI=----ATTACHMENT:----NDgyOTg5NzQ4NDk3MDgyMiA5NDczNTY0NzUxNTU5ODU0IDk0NTg4MTg0NDMwNjY5Njk=