manifest.class.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License").
  6. * You may not use this file except in compliance with the License.
  7. * A copy of the License is located at
  8. *
  9. * http://aws.amazon.com/apache2.0
  10. *
  11. * or in the "license" file accompanying this file. This file is distributed
  12. * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  13. * express or implied. See the License for the specific language governing
  14. * permissions and limitations under the License.
  15. */
  16. /*%******************************************************************************************%*/
  17. // CLASS
  18. /**
  19. * Simplifies the process of generating manifests for the AWS Import/Export service.
  20. *
  21. * @version 2010.11.22
  22. * @license See the included NOTICE.md file for more information.
  23. * @copyright See the included NOTICE.md file for more information.
  24. * @link http://aws.amazon.com/php/ PHP Developer Center
  25. */
  26. class CFManifest
  27. {
  28. /**
  29. * Takes a JSON object as a string to convert to a YAML manifest.
  30. *
  31. * @param string $json (Required) A JSON object. The JSON string should use canonical rules (e.g., double quotes, quoted keys) as is required by PHP's <php:json_encode()> function.
  32. * @return string A YAML manifest document.
  33. */
  34. public static function json($json)
  35. {
  36. $map = json_decode($json, true);
  37. return sfYaml::dump($map);
  38. }
  39. /**
  40. * Takes an associative array to convert to a YAML manifest.
  41. *
  42. * @param array $map (Required) An associative array.
  43. * @return string A YAML manifest document.
  44. */
  45. public static function map($map)
  46. {
  47. return sfYaml::dump($map);
  48. }
  49. }