JsonPersistor.php 466 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Setup;
  7. /**
  8. * Persist json files.
  9. */
  10. class JsonPersistor
  11. {
  12. /**
  13. * Persist data to json file.
  14. *
  15. * @param array $data
  16. * @param string $path
  17. * @return bool
  18. */
  19. public function persist(array $data, $path)
  20. {
  21. return file_put_contents($path, json_encode($data, JSON_PRETTY_PRINT));
  22. }
  23. }