Json.php 748 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\Core\FileReader\Reader;
  3. use ThurData\Servers\KerioEmail\Core\ServiceLocator;
  4. /**
  5. * Description of Json
  6. *
  7. * @autor ThurData <info@thrudata.ch>
  8. */
  9. class Json extends AbstractType
  10. {
  11. protected function loadFile()
  12. {
  13. $return = [];
  14. try
  15. {
  16. if (file_exists($this->path . DS . $this->file))
  17. {
  18. $readFile = file_get_contents($this->path . DS . $this->file);
  19. $return = json_decode($readFile, true);
  20. }
  21. }
  22. catch (\Exception $e)
  23. {
  24. ServiceLocator::call('errorManager')->addError(self::class, $e->getMessage(), $e->getTrace());
  25. }
  26. $this->data = $return;
  27. }
  28. }