API Docs for: 1.0.1
Show:

File: src/server/php/Store/Format/Json.php

  1. <?php namespace Store\Format;
  2.  
  3. use Store\Format;
  4. use Store\Resource;
  5.  
  6. /**
  7. * Json Formatted Contents
  8. *
  9. * @class Json
  10. * @module Server
  11. */
  12. class Json implements Format {
  13.  
  14. /**
  15. * File extension
  16. * @property FILE_EXTENSION
  17. * @const
  18. * @type {String}
  19. */
  20. const FILE_EXTENSION = 'json';
  21. /**
  22. * Encode to format
  23. *
  24. * @method encode
  25. * @param {String} $datastore context identifier
  26. * @void
  27. */
  28. public static function Encode(Resource $resource){
  29. return json_encode($resource->content());
  30. }
  31.  
  32. /**
  33. * Decode from format
  34. *
  35. * @method decode
  36. * @param {String} $datastore context identifier
  37. * @void
  38. */
  39. public static function Decode(Resource $resource){
  40. return json_decode($resource->content());
  41. }
  42. }