YtsFlowCollections.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ---
  2. test: Simple Inline Array
  3. brief: >
  4. Sequences can be contained on a
  5. single line, using the inline syntax.
  6. Separate each entry with commas and
  7. enclose in square brackets.
  8. yaml: |
  9. seq: [ a, b, c ]
  10. php: |
  11. ['seq' => ['a', 'b', 'c']]
  12. ---
  13. test: Simple Inline Hash
  14. brief: >
  15. Mapping can also be contained on
  16. a single line, using the inline
  17. syntax. Each key-value pair is
  18. separated by a colon, with a comma
  19. between each entry in the mapping.
  20. Enclose with curly braces.
  21. yaml: |
  22. hash: { name: Steve, foo: bar }
  23. php: |
  24. ['hash' => ['name' => 'Steve', 'foo' => 'bar']]
  25. ---
  26. test: Multi-line Inline Collections
  27. todo: true
  28. brief: >
  29. Both inline sequences and inline mappings
  30. can span multiple lines, provided that you
  31. indent the additional lines.
  32. yaml: |
  33. languages: [ Ruby,
  34. Perl,
  35. Python ]
  36. websites: { YAML: yaml.org,
  37. Ruby: ruby-lang.org,
  38. Python: python.org,
  39. Perl: use.perl.org }
  40. php: |
  41. [
  42. 'languages' => ['Ruby', 'Perl', 'Python'],
  43. 'websites' => [
  44. 'YAML' => 'yaml.org',
  45. 'Ruby' => 'ruby-lang.org',
  46. 'Python' => 'python.org',
  47. 'Perl' => 'use.perl.org'
  48. ]
  49. ]
  50. ---
  51. test: Commas in Values (not in the spec!)
  52. todo: true
  53. brief: >
  54. List items in collections are delimited by commas, but
  55. there must be a space after each comma. This allows you
  56. to add numbers without quoting.
  57. yaml: |
  58. attendances: [ 45,123, 70,000, 17,222 ]
  59. php: |
  60. ['attendances' => [45123, 70000, 17222]]