Cloudflare - Version 4.2.0

Version Description

  • 2021-03-02 =

  • Allow configuration of Cloudflare credentials via environment variables

  • Prevent purging of cache before comments have been moderated

  • Remove unnecessary symfony/yaml dependency

Download this release

Release Info

Developer manatarms
Plugin Icon 128x128 Cloudflare
Version 4.2.0
Comparing to
See all releases

Code changes from version 4.1.0 to 4.2.0

Files changed (61) hide show
  1. cloudflare.loader.php +6 -2
  2. cloudflare.php +6 -1
  3. composer.json +3 -3
  4. composer.lock +132 -132
  5. config.json +1 -1
  6. output.log +11 -9
  7. readme.txt +7 -1
  8. src/WordPress/DataStore.php +20 -0
  9. src/WordPress/Hooks.php +29 -0
  10. vendor/autoload.php +1 -1
  11. vendor/composer/autoload_files.php +0 -10
  12. vendor/composer/autoload_psr4.php +0 -2
  13. vendor/composer/autoload_real.php +4 -22
  14. vendor/composer/autoload_static.php +4 -21
  15. vendor/composer/installed.json +0 -130
  16. vendor/symfony/polyfill-ctype/Ctype.php +0 -227
  17. vendor/symfony/polyfill-ctype/LICENSE +0 -19
  18. vendor/symfony/polyfill-ctype/README.md +0 -12
  19. vendor/symfony/polyfill-ctype/bootstrap.php +0 -50
  20. vendor/symfony/polyfill-ctype/bootstrap80.php +0 -46
  21. vendor/symfony/polyfill-ctype/composer.json +0 -38
  22. vendor/symfony/yaml/CHANGELOG.md +0 -28
  23. vendor/symfony/yaml/Dumper.php +0 -77
  24. vendor/symfony/yaml/Escaper.php +0 -101
  25. vendor/symfony/yaml/Exception/DumpException.php +0 -21
  26. vendor/symfony/yaml/Exception/ExceptionInterface.php +0 -21
  27. vendor/symfony/yaml/Exception/ParseException.php +0 -144
  28. vendor/symfony/yaml/Exception/RuntimeException.php +0 -21
  29. vendor/symfony/yaml/Inline.php +0 -609
  30. vendor/symfony/yaml/LICENSE +0 -19
  31. vendor/symfony/yaml/Parser.php +0 -852
  32. vendor/symfony/yaml/README.md +0 -13
  33. vendor/symfony/yaml/Tests/DumperTest.php +0 -257
  34. vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml +0 -31
  35. vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml +0 -202
  36. vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml +0 -51
  37. vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml +0 -85
  38. vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml +0 -25
  39. vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml +0 -60
  40. vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml +0 -176
  41. vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml +0 -45
  42. vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml +0 -1697
  43. vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml +0 -244
  44. vendor/symfony/yaml/Tests/Fixtures/embededPhp.yml +0 -1
  45. vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml +0 -155
  46. vendor/symfony/yaml/Tests/Fixtures/index.yml +0 -18
  47. vendor/symfony/yaml/Tests/Fixtures/sfComments.yml +0 -76
  48. vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml +0 -159
  49. vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml +0 -66
  50. vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml +0 -11
  51. vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml +0 -33
  52. vendor/symfony/yaml/Tests/Fixtures/sfTests.yml +0 -149
  53. vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml +0 -82
  54. vendor/symfony/yaml/Tests/InlineTest.php +0 -506
  55. vendor/symfony/yaml/Tests/ParseExceptionTest.php +0 -42
  56. vendor/symfony/yaml/Tests/ParserTest.php +0 -1300
  57. vendor/symfony/yaml/Tests/YamlTest.php +0 -56
  58. vendor/symfony/yaml/Unescaper.php +0 -156
  59. vendor/symfony/yaml/Yaml.php +0 -99
  60. vendor/symfony/yaml/composer.json +0 -34
  61. vendor/symfony/yaml/phpunit.xml.dist +0 -30
cloudflare.loader.php CHANGED
@@ -94,10 +94,8 @@ foreach ($cloudflarePurgeEverythingActions as $action) {
94
 
95
  $cloudflarePurgeURLActions = array(
96
  'deleted_post', // Delete a post
97
- 'edit_post', // Edit a post - includes leaving comments
98
  'delete_attachment', // Delete an attachment - includes re-uploading
99
  'post_updated', // Update a post
100
- 'comment_post', // Post a comment
101
  );
102
 
103
  $cloudflarePurgeURLActions = apply_filters('cloudflare_purge_url_actions', $cloudflarePurgeURLActions);
@@ -105,3 +103,9 @@ $cloudflarePurgeURLActions = apply_filters('cloudflare_purge_url_actions', $clou
105
  foreach ($cloudflarePurgeURLActions as $action) {
106
  add_action($action, array($cloudflareHooks, 'purgeCacheByRelevantURLs'), PHP_INT_MAX, 2);
107
  }
 
 
 
 
 
 
94
 
95
  $cloudflarePurgeURLActions = array(
96
  'deleted_post', // Delete a post
 
97
  'delete_attachment', // Delete an attachment - includes re-uploading
98
  'post_updated', // Update a post
 
99
  );
100
 
101
  $cloudflarePurgeURLActions = apply_filters('cloudflare_purge_url_actions', $cloudflarePurgeURLActions);
103
  foreach ($cloudflarePurgeURLActions as $action) {
104
  add_action($action, array($cloudflareHooks, 'purgeCacheByRelevantURLs'), PHP_INT_MAX, 2);
105
  }
106
+
107
+ /**
108
+ * Register two new actions which account for comment status before purging cache
109
+ */
110
+ add_action('transition_comment_status', array($cloudflareHooks, 'purgeCacheOnCommentStatusChange'), PHP_INT_MAX, 3);
111
+ add_action('comment_post', array($cloudflareHooks, 'purgeCacheOnNewComment'), PHP_INT_MAX, 3);
cloudflare.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Cloudflare
4
  Plugin URI: https://blog.cloudflare.com/new-wordpress-plugin/
5
  Description: Cloudflare speeds up and protects your WordPress site.
6
- Version: 4.1.0
7
  Requires PHP: 7.2
8
  Author: Cloudflare, Inc.
9
  License: BSD-3-Clause
@@ -11,6 +11,11 @@ License: BSD-3-Clause
11
 
12
  // The following constants are available. Add them to wp-config.php to enable.
13
 
 
 
 
 
 
14
  // To enable HTTP/2 Server Push feature:
15
  // define('CLOUDFLARE_HTTP2_SERVER_PUSH_ACTIVE', true);
16
 
3
  Plugin Name: Cloudflare
4
  Plugin URI: https://blog.cloudflare.com/new-wordpress-plugin/
5
  Description: Cloudflare speeds up and protects your WordPress site.
6
+ Version: 4.2.0
7
  Requires PHP: 7.2
8
  Author: Cloudflare, Inc.
9
  License: BSD-3-Clause
11
 
12
  // The following constants are available. Add them to wp-config.php to enable.
13
 
14
+ // To configure Cloudflare credentials via environment vars (defined elsewhere)
15
+ // define('CLOUDFLARE_EMAIL', $_ENV['CLOUDFLARE_EMAIL']);
16
+ // define('CLOUDFLARE_API_KEY', $_ENV['CLOUDFLARE_API_KEY']);
17
+ // define('CLOUDFLARE_DOMAIN_NAME', $_ENV['CLOUDFLARE_DOMAIN_NAME']);
18
+
19
  // To enable HTTP/2 Server Push feature:
20
  // define('CLOUDFLARE_HTTP2_SERVER_PUSH_ACTIVE', true);
21
 
composer.json CHANGED
@@ -10,10 +10,10 @@
10
  "type": "wordpress-plugin",
11
  "require": {
12
  "cloudflare/cf-ip-rewrite": "^1.0.0",
13
- "cloudflare/cloudflare-plugin-backend": "2.4.0",
14
- "symfony/yaml": "~2.6"
15
  },
16
  "require-dev": {
 
17
  "johnkary/phpunit-speedtrap": "^3",
18
  "php-mock/php-mock-phpunit": "^2",
19
  "phpunit/phpunit": "^8",
@@ -31,7 +31,7 @@
31
  "_comment": [
32
  "php-compatibility-install comes from https://github.com/wimg/PHPCompatibility/issues/102#issuecomment-255778195"
33
  ],
34
- "version": "4.1.0",
35
  "config": {
36
  "platform": {
37
  "php": "7.2"
10
  "type": "wordpress-plugin",
11
  "require": {
12
  "cloudflare/cf-ip-rewrite": "^1.0.0",
13
+ "cloudflare/cloudflare-plugin-backend": "2.4.0"
 
14
  },
15
  "require-dev": {
16
+ "symfony/yaml": "~2.6",
17
  "johnkary/phpunit-speedtrap": "^3",
18
  "php-mock/php-mock-phpunit": "^2",
19
  "phpunit/phpunit": "^8",
31
  "_comment": [
32
  "php-compatibility-install comes from https://github.com/wimg/PHPCompatibility/issues/102#issuecomment-255778195"
33
  ],
34
+ "version": "4.2.0",
35
  "config": {
36
  "platform": {
37
  "php": "7.2"
composer.lock CHANGED
@@ -4,7 +4,7 @@
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
- "content-hash": "d8c0cab412ae81b7f5be9a98b273cc59",
8
  "packages": [
9
  {
10
  "name": "cloudflare/cf-ip-rewrite",
@@ -132,132 +132,6 @@
132
  "psr-3"
133
  ],
134
  "time": "2020-03-23T09:12:05+00:00"
135
- },
136
- {
137
- "name": "symfony/polyfill-ctype",
138
- "version": "v1.22.0",
139
- "source": {
140
- "type": "git",
141
- "url": "https://github.com/symfony/polyfill-ctype.git",
142
- "reference": "c6c942b1ac76c82448322025e084cadc56048b4e"
143
- },
144
- "dist": {
145
- "type": "zip",
146
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e",
147
- "reference": "c6c942b1ac76c82448322025e084cadc56048b4e",
148
- "shasum": ""
149
- },
150
- "require": {
151
- "php": ">=7.1"
152
- },
153
- "suggest": {
154
- "ext-ctype": "For best performance"
155
- },
156
- "type": "library",
157
- "extra": {
158
- "branch-alias": {
159
- "dev-main": "1.22-dev"
160
- },
161
- "thanks": {
162
- "name": "symfony/polyfill",
163
- "url": "https://github.com/symfony/polyfill"
164
- }
165
- },
166
- "autoload": {
167
- "psr-4": {
168
- "Symfony\\Polyfill\\Ctype\\": ""
169
- },
170
- "files": [
171
- "bootstrap.php"
172
- ]
173
- },
174
- "notification-url": "https://packagist.org/downloads/",
175
- "license": [
176
- "MIT"
177
- ],
178
- "authors": [
179
- {
180
- "name": "Gert de Pagter",
181
- "email": "BackEndTea@gmail.com"
182
- },
183
- {
184
- "name": "Symfony Community",
185
- "homepage": "https://symfony.com/contributors"
186
- }
187
- ],
188
- "description": "Symfony polyfill for ctype functions",
189
- "homepage": "https://symfony.com",
190
- "keywords": [
191
- "compatibility",
192
- "ctype",
193
- "polyfill",
194
- "portable"
195
- ],
196
- "funding": [
197
- {
198
- "url": "https://symfony.com/sponsor",
199
- "type": "custom"
200
- },
201
- {
202
- "url": "https://github.com/fabpot",
203
- "type": "github"
204
- },
205
- {
206
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
207
- "type": "tidelift"
208
- }
209
- ],
210
- "time": "2021-01-07T16:49:33+00:00"
211
- },
212
- {
213
- "name": "symfony/yaml",
214
- "version": "v2.8.52",
215
- "source": {
216
- "type": "git",
217
- "url": "https://github.com/symfony/yaml.git",
218
- "reference": "02c1859112aa779d9ab394ae4f3381911d84052b"
219
- },
220
- "dist": {
221
- "type": "zip",
222
- "url": "https://api.github.com/repos/symfony/yaml/zipball/02c1859112aa779d9ab394ae4f3381911d84052b",
223
- "reference": "02c1859112aa779d9ab394ae4f3381911d84052b",
224
- "shasum": ""
225
- },
226
- "require": {
227
- "php": ">=5.3.9",
228
- "symfony/polyfill-ctype": "~1.8"
229
- },
230
- "type": "library",
231
- "extra": {
232
- "branch-alias": {
233
- "dev-master": "2.8-dev"
234
- }
235
- },
236
- "autoload": {
237
- "psr-4": {
238
- "Symfony\\Component\\Yaml\\": ""
239
- },
240
- "exclude-from-classmap": [
241
- "/Tests/"
242
- ]
243
- },
244
- "notification-url": "https://packagist.org/downloads/",
245
- "license": [
246
- "MIT"
247
- ],
248
- "authors": [
249
- {
250
- "name": "Fabien Potencier",
251
- "email": "fabien@symfony.com"
252
- },
253
- {
254
- "name": "Symfony Community",
255
- "homepage": "https://symfony.com/contributors"
256
- }
257
- ],
258
- "description": "Symfony Yaml Component",
259
- "homepage": "https://symfony.com",
260
- "time": "2018-11-11T11:18:13+00:00"
261
  }
262
  ],
263
  "packages-dev": [
@@ -552,16 +426,16 @@
552
  },
553
  {
554
  "name": "phar-io/version",
555
- "version": "3.0.4",
556
  "source": {
557
  "type": "git",
558
  "url": "https://github.com/phar-io/version.git",
559
- "reference": "e4782611070e50613683d2b9a57730e9a3ba5451"
560
  },
561
  "dist": {
562
  "type": "zip",
563
- "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451",
564
- "reference": "e4782611070e50613683d2b9a57730e9a3ba5451",
565
  "shasum": ""
566
  },
567
  "require": {
@@ -595,7 +469,7 @@
595
  }
596
  ],
597
  "description": "Library for handling version information and constraints",
598
- "time": "2020-12-13T23:18:30+00:00"
599
  },
600
  {
601
  "name": "php-mock/php-mock",
@@ -2224,6 +2098,132 @@
2224
  ],
2225
  "time": "2018-11-07T22:31:41+00:00"
2226
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2227
  {
2228
  "name": "theseer/tokenizer",
2229
  "version": "1.2.0",
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
+ "content-hash": "6aaea7a30629e971b9a544dfc6298b15",
8
  "packages": [
9
  {
10
  "name": "cloudflare/cf-ip-rewrite",
132
  "psr-3"
133
  ],
134
  "time": "2020-03-23T09:12:05+00:00"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
  ],
137
  "packages-dev": [
426
  },
427
  {
428
  "name": "phar-io/version",
429
+ "version": "3.1.0",
430
  "source": {
431
  "type": "git",
432
  "url": "https://github.com/phar-io/version.git",
433
+ "reference": "bae7c545bef187884426f042434e561ab1ddb182"
434
  },
435
  "dist": {
436
  "type": "zip",
437
+ "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182",
438
+ "reference": "bae7c545bef187884426f042434e561ab1ddb182",
439
  "shasum": ""
440
  },
441
  "require": {
469
  }
470
  ],
471
  "description": "Library for handling version information and constraints",
472
+ "time": "2021-02-23T14:00:09+00:00"
473
  },
474
  {
475
  "name": "php-mock/php-mock",
2098
  ],
2099
  "time": "2018-11-07T22:31:41+00:00"
2100
  },
2101
+ {
2102
+ "name": "symfony/polyfill-ctype",
2103
+ "version": "v1.22.1",
2104
+ "source": {
2105
+ "type": "git",
2106
+ "url": "https://github.com/symfony/polyfill-ctype.git",
2107
+ "reference": "c6c942b1ac76c82448322025e084cadc56048b4e"
2108
+ },
2109
+ "dist": {
2110
+ "type": "zip",
2111
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e",
2112
+ "reference": "c6c942b1ac76c82448322025e084cadc56048b4e",
2113
+ "shasum": ""
2114
+ },
2115
+ "require": {
2116
+ "php": ">=7.1"
2117
+ },
2118
+ "suggest": {
2119
+ "ext-ctype": "For best performance"
2120
+ },
2121
+ "type": "library",
2122
+ "extra": {
2123
+ "branch-alias": {
2124
+ "dev-main": "1.22-dev"
2125
+ },
2126
+ "thanks": {
2127
+ "name": "symfony/polyfill",
2128
+ "url": "https://github.com/symfony/polyfill"
2129
+ }
2130
+ },
2131
+ "autoload": {
2132
+ "psr-4": {
2133
+ "Symfony\\Polyfill\\Ctype\\": ""
2134
+ },
2135
+ "files": [
2136
+ "bootstrap.php"
2137
+ ]
2138
+ },
2139
+ "notification-url": "https://packagist.org/downloads/",
2140
+ "license": [
2141
+ "MIT"
2142
+ ],
2143
+ "authors": [
2144
+ {
2145
+ "name": "Gert de Pagter",
2146
+ "email": "BackEndTea@gmail.com"
2147
+ },
2148
+ {
2149
+ "name": "Symfony Community",
2150
+ "homepage": "https://symfony.com/contributors"
2151
+ }
2152
+ ],
2153
+ "description": "Symfony polyfill for ctype functions",
2154
+ "homepage": "https://symfony.com",
2155
+ "keywords": [
2156
+ "compatibility",
2157
+ "ctype",
2158
+ "polyfill",
2159
+ "portable"
2160
+ ],
2161
+ "funding": [
2162
+ {
2163
+ "url": "https://symfony.com/sponsor",
2164
+ "type": "custom"
2165
+ },
2166
+ {
2167
+ "url": "https://github.com/fabpot",
2168
+ "type": "github"
2169
+ },
2170
+ {
2171
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
2172
+ "type": "tidelift"
2173
+ }
2174
+ ],
2175
+ "time": "2021-01-07T16:49:33+00:00"
2176
+ },
2177
+ {
2178
+ "name": "symfony/yaml",
2179
+ "version": "v2.8.52",
2180
+ "source": {
2181
+ "type": "git",
2182
+ "url": "https://github.com/symfony/yaml.git",
2183
+ "reference": "02c1859112aa779d9ab394ae4f3381911d84052b"
2184
+ },
2185
+ "dist": {
2186
+ "type": "zip",
2187
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/02c1859112aa779d9ab394ae4f3381911d84052b",
2188
+ "reference": "02c1859112aa779d9ab394ae4f3381911d84052b",
2189
+ "shasum": ""
2190
+ },
2191
+ "require": {
2192
+ "php": ">=5.3.9",
2193
+ "symfony/polyfill-ctype": "~1.8"
2194
+ },
2195
+ "type": "library",
2196
+ "extra": {
2197
+ "branch-alias": {
2198
+ "dev-master": "2.8-dev"
2199
+ }
2200
+ },
2201
+ "autoload": {
2202
+ "psr-4": {
2203
+ "Symfony\\Component\\Yaml\\": ""
2204
+ },
2205
+ "exclude-from-classmap": [
2206
+ "/Tests/"
2207
+ ]
2208
+ },
2209
+ "notification-url": "https://packagist.org/downloads/",
2210
+ "license": [
2211
+ "MIT"
2212
+ ],
2213
+ "authors": [
2214
+ {
2215
+ "name": "Fabien Potencier",
2216
+ "email": "fabien@symfony.com"
2217
+ },
2218
+ {
2219
+ "name": "Symfony Community",
2220
+ "homepage": "https://symfony.com/contributors"
2221
+ }
2222
+ ],
2223
+ "description": "Symfony Yaml Component",
2224
+ "homepage": "https://symfony.com",
2225
+ "time": "2018-11-11T11:18:13+00:00"
2226
+ },
2227
  {
2228
  "name": "theseer/tokenizer",
2229
  "version": "1.2.0",
config.json CHANGED
@@ -25,5 +25,5 @@
25
  },
26
  "locale": "en",
27
  "integrationName": "wordpress",
28
- "version": "4.1.0"
29
  }
25
  },
26
  "locale": "en",
27
  "integrationName": "wordpress",
28
+ "version": "4.2.0"
29
  }
output.log CHANGED
@@ -30,28 +30,30 @@ php-7.4-build2: Pulling from cloudflare/cloudflare-wordpress/php-actions_compose
30
  4d1e94121e00: Waiting
31
  320f26ee9b1c: Verifying Checksum
32
  320f26ee9b1c: Download complete
33
- 801bfaa63ef2: Verifying Checksum
34
- 801bfaa63ef2: Download complete
35
  30e209609427: Verifying Checksum
36
  30e209609427: Download complete
37
- 801bfaa63ef2: Pull complete
38
  4612e05a72cf: Verifying Checksum
39
  4612e05a72cf: Download complete
40
- 30e209609427: Pull complete
41
  79c03e12047a: Download complete
42
- 320f26ee9b1c: Pull complete
43
- 4612e05a72cf: Pull complete
44
  9b2beae78beb: Verifying Checksum
45
  9b2beae78beb: Download complete
46
  5571c1cd7f43: Verifying Checksum
47
  5571c1cd7f43: Download complete
48
- 9b2beae78beb: Pull complete
49
- 79c03e12047a: Pull complete
50
- 65564f077fec: Download complete
51
  51393fef6543: Verifying Checksum
52
  51393fef6543: Download complete
 
 
 
 
53
  4d1e94121e00: Verifying Checksum
54
  4d1e94121e00: Download complete
 
 
 
 
 
 
55
  51393fef6543: Pull complete
56
  5571c1cd7f43: Pull complete
57
  65564f077fec: Pull complete
30
  4d1e94121e00: Waiting
31
  320f26ee9b1c: Verifying Checksum
32
  320f26ee9b1c: Download complete
 
 
33
  30e209609427: Verifying Checksum
34
  30e209609427: Download complete
 
35
  4612e05a72cf: Verifying Checksum
36
  4612e05a72cf: Download complete
37
+ 79c03e12047a: Verifying Checksum
38
  79c03e12047a: Download complete
 
 
39
  9b2beae78beb: Verifying Checksum
40
  9b2beae78beb: Download complete
41
  5571c1cd7f43: Verifying Checksum
42
  5571c1cd7f43: Download complete
 
 
 
43
  51393fef6543: Verifying Checksum
44
  51393fef6543: Download complete
45
+ 65564f077fec: Verifying Checksum
46
+ 65564f077fec: Download complete
47
+ 801bfaa63ef2: Verifying Checksum
48
+ 801bfaa63ef2: Download complete
49
  4d1e94121e00: Verifying Checksum
50
  4d1e94121e00: Download complete
51
+ 801bfaa63ef2: Pull complete
52
+ 30e209609427: Pull complete
53
+ 320f26ee9b1c: Pull complete
54
+ 4612e05a72cf: Pull complete
55
+ 9b2beae78beb: Pull complete
56
+ 79c03e12047a: Pull complete
57
  51393fef6543: Pull complete
58
  5571c1cd7f43: Pull complete
59
  65564f077fec: Pull complete
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: icyapril, manatarms, thillcf, deuill, epatryk, jacobbednarz
3
  Tags: cloudflare, seo, ssl, ddos, speed, security, cdn, performance, free
4
  Requires at least: 3.4
5
  Tested up to: 5.6
6
- Stable tag: 4.1.0
7
  Requires PHP: 7.2
8
  License: BSD-3-Clause
9
 
@@ -91,6 +91,12 @@ Yes, Cloudflare works with, and helps speed up your site even more, if you have
91
 
92
  == Changelog ==
93
 
 
 
 
 
 
 
94
  = 4.1.0 - 2021-02-11 =
95
 
96
  * Removed development dependencies from vendor directory
3
  Tags: cloudflare, seo, ssl, ddos, speed, security, cdn, performance, free
4
  Requires at least: 3.4
5
  Tested up to: 5.6
6
+ Stable tag: 4.2.0
7
  Requires PHP: 7.2
8
  License: BSD-3-Clause
9
 
91
 
92
  == Changelog ==
93
 
94
+ = 4.2.0 - 2021-03-02 =
95
+
96
+ * Allow configuration of Cloudflare credentials via environment variables
97
+ * Prevent purging of cache before comments have been moderated
98
+ * Remove unnecessary symfony/yaml dependency
99
+
100
  = 4.1.0 - 2021-02-11 =
101
 
102
  * Removed development dependencies from vendor directory
src/WordPress/DataStore.php CHANGED
@@ -39,6 +39,10 @@ class DataStore implements DataStoreInterface
39
  */
40
  public function createUserDataStore($client_api_key, $email, $unique_id, $user_key)
41
  {
 
 
 
 
42
  // Clear options
43
  $this->set(self::API_KEY, '');
44
  $this->set(self::EMAIL, '');
@@ -63,6 +67,10 @@ class DataStore implements DataStoreInterface
63
  */
64
  public function getClientV4APIKey()
65
  {
 
 
 
 
66
  return $this->get(self::API_KEY);
67
  }
68
 
@@ -79,6 +87,10 @@ class DataStore implements DataStoreInterface
79
  */
80
  public function getDomainNameCache()
81
  {
 
 
 
 
82
  $cachedDomainName = $this->get(self::CACHED_DOMAIN_NAME);
83
  if (empty($cachedDomainName)) {
84
  return;
@@ -92,6 +104,10 @@ class DataStore implements DataStoreInterface
92
  */
93
  public function setDomainNameCache($domainName)
94
  {
 
 
 
 
95
  return $this->set(self::CACHED_DOMAIN_NAME, $domainName);
96
  }
97
 
@@ -100,6 +116,10 @@ class DataStore implements DataStoreInterface
100
  */
101
  public function getCloudFlareEmail()
102
  {
 
 
 
 
103
  return $this->get(self::EMAIL);
104
  }
105
 
39
  */
40
  public function createUserDataStore($client_api_key, $email, $unique_id, $user_key)
41
  {
42
+ if (defined('CLOUDFLARE_API_KEY') && defined('CLOUDFLARE_EMAIL')) {
43
+ return true;
44
+ }
45
+
46
  // Clear options
47
  $this->set(self::API_KEY, '');
48
  $this->set(self::EMAIL, '');
67
  */
68
  public function getClientV4APIKey()
69
  {
70
+ if (defined('CLOUDFLARE_API_KEY') && CLOUDFLARE_API_KEY !== '') {
71
+ return CLOUDFLARE_API_KEY;
72
+ }
73
+
74
  return $this->get(self::API_KEY);
75
  }
76
 
87
  */
88
  public function getDomainNameCache()
89
  {
90
+ if (defined('CLOUDFLARE_DOMAIN_NAME') && CLOUDFLARE_DOMAIN_NAME !== '') {
91
+ return CLOUDFLARE_DOMAIN_NAME;
92
+ }
93
+
94
  $cachedDomainName = $this->get(self::CACHED_DOMAIN_NAME);
95
  if (empty($cachedDomainName)) {
96
  return;
104
  */
105
  public function setDomainNameCache($domainName)
106
  {
107
+ if (defined('CLOUDFLARE_DOMAIN_NAME') && CLOUDFLARE_DOMAIN_NAME !== '') {
108
+ return;
109
+ }
110
+
111
  return $this->set(self::CACHED_DOMAIN_NAME, $domainName);
112
  }
113
 
116
  */
117
  public function getCloudFlareEmail()
118
  {
119
+ if (defined('CLOUDFLARE_EMAIL') && CLOUDFLARE_EMAIL !== '') {
120
+ return CLOUDFLARE_EMAIL;
121
+ }
122
+
123
  return $this->get(self::EMAIL);
124
  }
125
 
src/WordPress/Hooks.php CHANGED
@@ -322,4 +322,33 @@ class Hooks
322
  header('cf-edge-cache: no-cache');
323
  }
324
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  }
322
  header('cf-edge-cache: no-cache');
323
  }
324
  }
325
+
326
+ public function purgeCacheOnCommentStatusChange($new_status, $old_status, $comment)
327
+ {
328
+ if (!isset($comment->comment_post_ID) || empty($comment->comment_post_ID)) {
329
+ return; // nothing to do
330
+ }
331
+
332
+ // in case the comment status changed, and either old or new status is "approved", we need to purge cache for the corresponding post
333
+ if (($old_status != $new_status) && (($old_status === 'approved') || ($new_status === 'approved'))) {
334
+ $this->purgeCacheByRelevantURLs($comment->comment_post_ID);
335
+ return;
336
+ }
337
+ }
338
+
339
+ public function purgeCacheOnNewComment($comment_id, $comment_status, $comment_data)
340
+ {
341
+ if ($comment_status != 1) {
342
+ return; // if comment is not approved, stop
343
+ }
344
+ if (!is_array($comment_data)) {
345
+ return; // nothing to do
346
+ }
347
+ if (!array_key_exists('comment_post_ID', $comment_data)) {
348
+ return; // nothing to do
349
+ }
350
+
351
+ // all clear, we ne need to purge cache related to this post id
352
+ $this->purgeCacheByRelevantURLs($comment_data['comment_post_ID']);
353
+ }
354
  }
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitc18900f6a542da4a0b530114484e7cc6::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit4a0fd069dc93c916ca040288bc077bd4::getLoader();
vendor/composer/autoload_files.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
- // autoload_files.php @generated by Composer
4
-
5
- $vendorDir = dirname(dirname(__FILE__));
6
- $baseDir = dirname($vendorDir);
7
-
8
- return array(
9
- '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
10
- );
 
 
 
 
 
 
 
 
 
 
vendor/composer/autoload_psr4.php CHANGED
@@ -6,8 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
10
- 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
11
  'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
12
  'CF\\' => array($baseDir . '/src', $vendorDir . '/cloudflare/cloudflare-plugin-backend/src'),
13
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
 
9
  'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
10
  'CF\\' => array($baseDir . '/src', $vendorDir . '/cloudflare/cloudflare-plugin-backend/src'),
11
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitc18900f6a542da4a0b530114484e7cc6
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitc18900f6a542da4a0b530114484e7cc6
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitc18900f6a542da4a0b530114484e7cc6', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitc18900f6a542da4a0b530114484e7cc6', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitc18900f6a542da4a0b530114484e7cc6::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -50,24 +50,6 @@ class ComposerAutoloaderInitc18900f6a542da4a0b530114484e7cc6
50
 
51
  $loader->register(true);
52
 
53
- if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInitc18900f6a542da4a0b530114484e7cc6::$files;
55
- } else {
56
- $includeFiles = require __DIR__ . '/autoload_files.php';
57
- }
58
- foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequirec18900f6a542da4a0b530114484e7cc6($fileIdentifier, $file);
60
- }
61
-
62
  return $loader;
63
  }
64
  }
65
-
66
- function composerRequirec18900f6a542da4a0b530114484e7cc6($fileIdentifier, $file)
67
- {
68
- if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
- require $file;
70
-
71
- $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
72
- }
73
- }
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit4a0fd069dc93c916ca040288bc077bd4
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit4a0fd069dc93c916ca040288bc077bd4', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit4a0fd069dc93c916ca040288bc077bd4', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit4a0fd069dc93c916ca040288bc077bd4::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
50
 
51
  $loader->register(true);
52
 
 
 
 
 
 
 
 
 
 
53
  return $loader;
54
  }
55
  }
 
 
 
 
 
 
 
 
 
vendor/composer/autoload_static.php CHANGED
@@ -4,18 +4,9 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitc18900f6a542da4a0b530114484e7cc6
8
  {
9
- public static $files = array (
10
- '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
11
- );
12
-
13
  public static $prefixLengthsPsr4 = array (
14
- 'S' =>
15
- array (
16
- 'Symfony\\Polyfill\\Ctype\\' => 23,
17
- 'Symfony\\Component\\Yaml\\' => 23,
18
- ),
19
  'P' =>
20
  array (
21
  'Psr\\Log\\' => 8,
@@ -27,14 +18,6 @@ class ComposerStaticInitc18900f6a542da4a0b530114484e7cc6
27
  );
28
 
29
  public static $prefixDirsPsr4 = array (
30
- 'Symfony\\Polyfill\\Ctype\\' =>
31
- array (
32
- 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
33
- ),
34
- 'Symfony\\Component\\Yaml\\' =>
35
- array (
36
- 0 => __DIR__ . '/..' . '/symfony/yaml',
37
- ),
38
  'Psr\\Log\\' =>
39
  array (
40
  0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
@@ -59,9 +42,9 @@ class ComposerStaticInitc18900f6a542da4a0b530114484e7cc6
59
  public static function getInitializer(ClassLoader $loader)
60
  {
61
  return \Closure::bind(function () use ($loader) {
62
- $loader->prefixLengthsPsr4 = ComposerStaticInitc18900f6a542da4a0b530114484e7cc6::$prefixLengthsPsr4;
63
- $loader->prefixDirsPsr4 = ComposerStaticInitc18900f6a542da4a0b530114484e7cc6::$prefixDirsPsr4;
64
- $loader->prefixesPsr0 = ComposerStaticInitc18900f6a542da4a0b530114484e7cc6::$prefixesPsr0;
65
 
66
  }, null, ClassLoader::class);
67
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit4a0fd069dc93c916ca040288bc077bd4
8
  {
 
 
 
 
9
  public static $prefixLengthsPsr4 = array (
 
 
 
 
 
10
  'P' =>
11
  array (
12
  'Psr\\Log\\' => 8,
18
  );
19
 
20
  public static $prefixDirsPsr4 = array (
 
 
 
 
 
 
 
 
21
  'Psr\\Log\\' =>
22
  array (
23
  0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
42
  public static function getInitializer(ClassLoader $loader)
43
  {
44
  return \Closure::bind(function () use ($loader) {
45
+ $loader->prefixLengthsPsr4 = ComposerStaticInit4a0fd069dc93c916ca040288bc077bd4::$prefixLengthsPsr4;
46
+ $loader->prefixDirsPsr4 = ComposerStaticInit4a0fd069dc93c916ca040288bc077bd4::$prefixDirsPsr4;
47
+ $loader->prefixesPsr0 = ComposerStaticInit4a0fd069dc93c916ca040288bc077bd4::$prefixesPsr0;
48
 
49
  }, null, ClassLoader::class);
50
  }
vendor/composer/installed.json CHANGED
@@ -131,135 +131,5 @@
131
  "psr",
132
  "psr-3"
133
  ]
134
- },
135
- {
136
- "name": "symfony/polyfill-ctype",
137
- "version": "v1.22.0",
138
- "version_normalized": "1.22.0.0",
139
- "source": {
140
- "type": "git",
141
- "url": "https://github.com/symfony/polyfill-ctype.git",
142
- "reference": "c6c942b1ac76c82448322025e084cadc56048b4e"
143
- },
144
- "dist": {
145
- "type": "zip",
146
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e",
147
- "reference": "c6c942b1ac76c82448322025e084cadc56048b4e",
148
- "shasum": ""
149
- },
150
- "require": {
151
- "php": ">=7.1"
152
- },
153
- "suggest": {
154
- "ext-ctype": "For best performance"
155
- },
156
- "time": "2021-01-07T16:49:33+00:00",
157
- "type": "library",
158
- "extra": {
159
- "branch-alias": {
160
- "dev-main": "1.22-dev"
161
- },
162
- "thanks": {
163
- "name": "symfony/polyfill",
164
- "url": "https://github.com/symfony/polyfill"
165
- }
166
- },
167
- "installation-source": "dist",
168
- "autoload": {
169
- "psr-4": {
170
- "Symfony\\Polyfill\\Ctype\\": ""
171
- },
172
- "files": [
173
- "bootstrap.php"
174
- ]
175
- },
176
- "notification-url": "https://packagist.org/downloads/",
177
- "license": [
178
- "MIT"
179
- ],
180
- "authors": [
181
- {
182
- "name": "Gert de Pagter",
183
- "email": "BackEndTea@gmail.com"
184
- },
185
- {
186
- "name": "Symfony Community",
187
- "homepage": "https://symfony.com/contributors"
188
- }
189
- ],
190
- "description": "Symfony polyfill for ctype functions",
191
- "homepage": "https://symfony.com",
192
- "keywords": [
193
- "compatibility",
194
- "ctype",
195
- "polyfill",
196
- "portable"
197
- ],
198
- "funding": [
199
- {
200
- "url": "https://symfony.com/sponsor",
201
- "type": "custom"
202
- },
203
- {
204
- "url": "https://github.com/fabpot",
205
- "type": "github"
206
- },
207
- {
208
- "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
209
- "type": "tidelift"
210
- }
211
- ]
212
- },
213
- {
214
- "name": "symfony/yaml",
215
- "version": "v2.8.52",
216
- "version_normalized": "2.8.52.0",
217
- "source": {
218
- "type": "git",
219
- "url": "https://github.com/symfony/yaml.git",
220
- "reference": "02c1859112aa779d9ab394ae4f3381911d84052b"
221
- },
222
- "dist": {
223
- "type": "zip",
224
- "url": "https://api.github.com/repos/symfony/yaml/zipball/02c1859112aa779d9ab394ae4f3381911d84052b",
225
- "reference": "02c1859112aa779d9ab394ae4f3381911d84052b",
226
- "shasum": ""
227
- },
228
- "require": {
229
- "php": ">=5.3.9",
230
- "symfony/polyfill-ctype": "~1.8"
231
- },
232
- "time": "2018-11-11T11:18:13+00:00",
233
- "type": "library",
234
- "extra": {
235
- "branch-alias": {
236
- "dev-master": "2.8-dev"
237
- }
238
- },
239
- "installation-source": "dist",
240
- "autoload": {
241
- "psr-4": {
242
- "Symfony\\Component\\Yaml\\": ""
243
- },
244
- "exclude-from-classmap": [
245
- "/Tests/"
246
- ]
247
- },
248
- "notification-url": "https://packagist.org/downloads/",
249
- "license": [
250
- "MIT"
251
- ],
252
- "authors": [
253
- {
254
- "name": "Fabien Potencier",
255
- "email": "fabien@symfony.com"
256
- },
257
- {
258
- "name": "Symfony Community",
259
- "homepage": "https://symfony.com/contributors"
260
- }
261
- ],
262
- "description": "Symfony Yaml Component",
263
- "homepage": "https://symfony.com"
264
  }
265
  ]
131
  "psr",
132
  "psr-3"
133
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
  ]
vendor/symfony/polyfill-ctype/Ctype.php DELETED
@@ -1,227 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Polyfill\Ctype;
13
-
14
- /**
15
- * Ctype implementation through regex.
16
- *
17
- * @internal
18
- *
19
- * @author Gert de Pagter <BackEndTea@gmail.com>
20
- */
21
- final class Ctype
22
- {
23
- /**
24
- * Returns TRUE if every character in text is either a letter or a digit, FALSE otherwise.
25
- *
26
- * @see https://php.net/ctype-alnum
27
- *
28
- * @param string|int $text
29
- *
30
- * @return bool
31
- */
32
- public static function ctype_alnum($text)
33
- {
34
- $text = self::convert_int_to_char_for_ctype($text);
35
-
36
- return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
37
- }
38
-
39
- /**
40
- * Returns TRUE if every character in text is a letter, FALSE otherwise.
41
- *
42
- * @see https://php.net/ctype-alpha
43
- *
44
- * @param string|int $text
45
- *
46
- * @return bool
47
- */
48
- public static function ctype_alpha($text)
49
- {
50
- $text = self::convert_int_to_char_for_ctype($text);
51
-
52
- return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
53
- }
54
-
55
- /**
56
- * Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise.
57
- *
58
- * @see https://php.net/ctype-cntrl
59
- *
60
- * @param string|int $text
61
- *
62
- * @return bool
63
- */
64
- public static function ctype_cntrl($text)
65
- {
66
- $text = self::convert_int_to_char_for_ctype($text);
67
-
68
- return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
69
- }
70
-
71
- /**
72
- * Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise.
73
- *
74
- * @see https://php.net/ctype-digit
75
- *
76
- * @param string|int $text
77
- *
78
- * @return bool
79
- */
80
- public static function ctype_digit($text)
81
- {
82
- $text = self::convert_int_to_char_for_ctype($text);
83
-
84
- return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
85
- }
86
-
87
- /**
88
- * Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise.
89
- *
90
- * @see https://php.net/ctype-graph
91
- *
92
- * @param string|int $text
93
- *
94
- * @return bool
95
- */
96
- public static function ctype_graph($text)
97
- {
98
- $text = self::convert_int_to_char_for_ctype($text);
99
-
100
- return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
101
- }
102
-
103
- /**
104
- * Returns TRUE if every character in text is a lowercase letter.
105
- *
106
- * @see https://php.net/ctype-lower
107
- *
108
- * @param string|int $text
109
- *
110
- * @return bool
111
- */
112
- public static function ctype_lower($text)
113
- {
114
- $text = self::convert_int_to_char_for_ctype($text);
115
-
116
- return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
117
- }
118
-
119
- /**
120
- * Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all.
121
- *
122
- * @see https://php.net/ctype-print
123
- *
124
- * @param string|int $text
125
- *
126
- * @return bool
127
- */
128
- public static function ctype_print($text)
129
- {
130
- $text = self::convert_int_to_char_for_ctype($text);
131
-
132
- return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
133
- }
134
-
135
- /**
136
- * Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise.
137
- *
138
- * @see https://php.net/ctype-punct
139
- *
140
- * @param string|int $text
141
- *
142
- * @return bool
143
- */
144
- public static function ctype_punct($text)
145
- {
146
- $text = self::convert_int_to_char_for_ctype($text);
147
-
148
- return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
149
- }
150
-
151
- /**
152
- * Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters.
153
- *
154
- * @see https://php.net/ctype-space
155
- *
156
- * @param string|int $text
157
- *
158
- * @return bool
159
- */
160
- public static function ctype_space($text)
161
- {
162
- $text = self::convert_int_to_char_for_ctype($text);
163
-
164
- return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
165
- }
166
-
167
- /**
168
- * Returns TRUE if every character in text is an uppercase letter.
169
- *
170
- * @see https://php.net/ctype-upper
171
- *
172
- * @param string|int $text
173
- *
174
- * @return bool
175
- */
176
- public static function ctype_upper($text)
177
- {
178
- $text = self::convert_int_to_char_for_ctype($text);
179
-
180
- return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
181
- }
182
-
183
- /**
184
- * Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise.
185
- *
186
- * @see https://php.net/ctype-xdigit
187
- *
188
- * @param string|int $text
189
- *
190
- * @return bool
191
- */
192
- public static function ctype_xdigit($text)
193
- {
194
- $text = self::convert_int_to_char_for_ctype($text);
195
-
196
- return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
197
- }
198
-
199
- /**
200
- * Converts integers to their char versions according to normal ctype behaviour, if needed.
201
- *
202
- * If an integer between -128 and 255 inclusive is provided,
203
- * it is interpreted as the ASCII value of a single character
204
- * (negative values have 256 added in order to allow characters in the Extended ASCII range).
205
- * Any other integer is interpreted as a string containing the decimal digits of the integer.
206
- *
207
- * @param string|int $int
208
- *
209
- * @return mixed
210
- */
211
- private static function convert_int_to_char_for_ctype($int)
212
- {
213
- if (!\is_int($int)) {
214
- return $int;
215
- }
216
-
217
- if ($int < -128 || $int > 255) {
218
- return (string) $int;
219
- }
220
-
221
- if ($int < 0) {
222
- $int += 256;
223
- }
224
-
225
- return \chr($int);
226
- }
227
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/polyfill-ctype/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2018-2019 Fabien Potencier
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is furnished
8
- to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/polyfill-ctype/README.md DELETED
@@ -1,12 +0,0 @@
1
- Symfony Polyfill / Ctype
2
- ========================
3
-
4
- This component provides `ctype_*` functions to users who run php versions without the ctype extension.
5
-
6
- More information can be found in the
7
- [main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
8
-
9
- License
10
- =======
11
-
12
- This library is released under the [MIT license](LICENSE).
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/polyfill-ctype/bootstrap.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Symfony\Polyfill\Ctype as p;
13
-
14
- if (\PHP_VERSION_ID >= 80000) {
15
- return require __DIR__.'/bootstrap80.php';
16
- }
17
-
18
- if (!function_exists('ctype_alnum')) {
19
- function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
20
- }
21
- if (!function_exists('ctype_alpha')) {
22
- function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
23
- }
24
- if (!function_exists('ctype_cntrl')) {
25
- function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
26
- }
27
- if (!function_exists('ctype_digit')) {
28
- function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
29
- }
30
- if (!function_exists('ctype_graph')) {
31
- function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
32
- }
33
- if (!function_exists('ctype_lower')) {
34
- function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
35
- }
36
- if (!function_exists('ctype_print')) {
37
- function ctype_print($text) { return p\Ctype::ctype_print($text); }
38
- }
39
- if (!function_exists('ctype_punct')) {
40
- function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
41
- }
42
- if (!function_exists('ctype_space')) {
43
- function ctype_space($text) { return p\Ctype::ctype_space($text); }
44
- }
45
- if (!function_exists('ctype_upper')) {
46
- function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
47
- }
48
- if (!function_exists('ctype_xdigit')) {
49
- function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/polyfill-ctype/bootstrap80.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- use Symfony\Polyfill\Ctype as p;
13
-
14
- if (!function_exists('ctype_alnum')) {
15
- function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); }
16
- }
17
- if (!function_exists('ctype_alpha')) {
18
- function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); }
19
- }
20
- if (!function_exists('ctype_cntrl')) {
21
- function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); }
22
- }
23
- if (!function_exists('ctype_digit')) {
24
- function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); }
25
- }
26
- if (!function_exists('ctype_graph')) {
27
- function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); }
28
- }
29
- if (!function_exists('ctype_lower')) {
30
- function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); }
31
- }
32
- if (!function_exists('ctype_print')) {
33
- function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); }
34
- }
35
- if (!function_exists('ctype_punct')) {
36
- function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); }
37
- }
38
- if (!function_exists('ctype_space')) {
39
- function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); }
40
- }
41
- if (!function_exists('ctype_upper')) {
42
- function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); }
43
- }
44
- if (!function_exists('ctype_xdigit')) {
45
- function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); }
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/polyfill-ctype/composer.json DELETED
@@ -1,38 +0,0 @@
1
- {
2
- "name": "symfony/polyfill-ctype",
3
- "type": "library",
4
- "description": "Symfony polyfill for ctype functions",
5
- "keywords": ["polyfill", "compatibility", "portable", "ctype"],
6
- "homepage": "https://symfony.com",
7
- "license": "MIT",
8
- "authors": [
9
- {
10
- "name": "Gert de Pagter",
11
- "email": "BackEndTea@gmail.com"
12
- },
13
- {
14
- "name": "Symfony Community",
15
- "homepage": "https://symfony.com/contributors"
16
- }
17
- ],
18
- "require": {
19
- "php": ">=7.1"
20
- },
21
- "autoload": {
22
- "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" },
23
- "files": [ "bootstrap.php" ]
24
- },
25
- "suggest": {
26
- "ext-ctype": "For best performance"
27
- },
28
- "minimum-stability": "dev",
29
- "extra": {
30
- "branch-alias": {
31
- "dev-main": "1.22-dev"
32
- },
33
- "thanks": {
34
- "name": "symfony/polyfill",
35
- "url": "https://github.com/symfony/polyfill"
36
- }
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/CHANGELOG.md DELETED
@@ -1,28 +0,0 @@
1
- CHANGELOG
2
- =========
3
-
4
- 2.8.0
5
- -----
6
-
7
- * Deprecated usage of a colon in an unquoted mapping value
8
- * Deprecated usage of @, \`, | and > at the beginning of an unquoted string
9
- * When surrounding strings with double-quotes, you must now escape `\` characters. Not
10
- escaping those characters (when surrounded by double-quotes) is deprecated.
11
-
12
- Before:
13
-
14
- ```yml
15
- class: "Foo\Var"
16
- ```
17
-
18
- After:
19
-
20
- ```yml
21
- class: "Foo\\Var"
22
- ```
23
-
24
- 2.1.0
25
- -----
26
-
27
- * Yaml::parse() does not evaluate loaded files as PHP files by default
28
- anymore (call Yaml::enablePhpParsing() to get back the old behavior)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Dumper.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml;
13
-
14
- /**
15
- * Dumper dumps PHP variables to YAML strings.
16
- *
17
- * @author Fabien Potencier <fabien@symfony.com>
18
- */
19
- class Dumper
20
- {
21
- /**
22
- * The amount of spaces to use for indentation of nested nodes.
23
- *
24
- * @var int
25
- */
26
- protected $indentation = 4;
27
-
28
- /**
29
- * Sets the indentation.
30
- *
31
- * @param int $num The amount of spaces to use for indentation of nested nodes
32
- */
33
- public function setIndentation($num)
34
- {
35
- if ($num < 1) {
36
- throw new \InvalidArgumentException('The indentation must be greater than zero.');
37
- }
38
-
39
- $this->indentation = (int) $num;
40
- }
41
-
42
- /**
43
- * Dumps a PHP value to YAML.
44
- *
45
- * @param mixed $input The PHP value
46
- * @param int $inline The level where you switch to inline YAML
47
- * @param int $indent The level of indentation (used internally)
48
- * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
49
- * @param bool $objectSupport True if object support is enabled, false otherwise
50
- *
51
- * @return string The YAML representation of the PHP value
52
- */
53
- public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = false, $objectSupport = false)
54
- {
55
- $output = '';
56
- $prefix = $indent ? str_repeat(' ', $indent) : '';
57
-
58
- if ($inline <= 0 || !\is_array($input) || empty($input)) {
59
- $output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport);
60
- } else {
61
- $isAHash = Inline::isHash($input);
62
-
63
- foreach ($input as $key => $value) {
64
- $willBeInlined = $inline - 1 <= 0 || !\is_array($value) || empty($value);
65
-
66
- $output .= sprintf('%s%s%s%s',
67
- $prefix,
68
- $isAHash ? Inline::dump($key, $exceptionOnInvalidType, $objectSupport).':' : '-',
69
- $willBeInlined ? ' ' : "\n",
70
- $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $exceptionOnInvalidType, $objectSupport)
71
- ).($willBeInlined ? "\n" : '');
72
- }
73
- }
74
-
75
- return $output;
76
- }
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Escaper.php DELETED
@@ -1,101 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml;
13
-
14
- /**
15
- * Escaper encapsulates escaping rules for single and double-quoted
16
- * YAML strings.
17
- *
18
- * @author Matthew Lewinski <matthew@lewinski.org>
19
- *
20
- * @internal
21
- */
22
- class Escaper
23
- {
24
- // Characters that would cause a dumped string to require double quoting.
25
- const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9";
26
-
27
- // Mapping arrays for escaping a double quoted string. The backslash is
28
- // first to ensure proper escaping because str_replace operates iteratively
29
- // on the input arrays. This ordering of the characters avoids the use of strtr,
30
- // which performs more slowly.
31
- private static $escapees = array('\\', '\\\\', '\\"', '"',
32
- "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07",
33
- "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f",
34
- "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17",
35
- "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f",
36
- "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",
37
- );
38
- private static $escaped = array('\\\\', '\\"', '\\\\', '\\"',
39
- '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a',
40
- '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f',
41
- '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17',
42
- '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f',
43
- '\\N', '\\_', '\\L', '\\P',
44
- );
45
-
46
- /**
47
- * Determines if a PHP value would require double quoting in YAML.
48
- *
49
- * @param string $value A PHP value
50
- *
51
- * @return bool True if the value would require double quotes
52
- */
53
- public static function requiresDoubleQuoting($value)
54
- {
55
- return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value);
56
- }
57
-
58
- /**
59
- * Escapes and surrounds a PHP value with double quotes.
60
- *
61
- * @param string $value A PHP value
62
- *
63
- * @return string The quoted, escaped string
64
- */
65
- public static function escapeWithDoubleQuotes($value)
66
- {
67
- return sprintf('"%s"', str_replace(self::$escapees, self::$escaped, $value));
68
- }
69
-
70
- /**
71
- * Determines if a PHP value would require single quoting in YAML.
72
- *
73
- * @param string $value A PHP value
74
- *
75
- * @return bool True if the value would require single quotes
76
- */
77
- public static function requiresSingleQuoting($value)
78
- {
79
- // Determines if a PHP value is entirely composed of a value that would
80
- // require single quoting in YAML.
81
- if (\in_array(strtolower($value), array('null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'))) {
82
- return true;
83
- }
84
-
85
- // Determines if the PHP value contains any single characters that would
86
- // cause it to require single quoting in YAML.
87
- return 0 < preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value);
88
- }
89
-
90
- /**
91
- * Escapes and surrounds a PHP value with single quotes.
92
- *
93
- * @param string $value A PHP value
94
- *
95
- * @return string The quoted, escaped string
96
- */
97
- public static function escapeWithSingleQuotes($value)
98
- {
99
- return sprintf("'%s'", str_replace('\'', '\'\'', $value));
100
- }
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Exception/DumpException.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Exception;
13
-
14
- /**
15
- * Exception class thrown when an error occurs during dumping.
16
- *
17
- * @author Fabien Potencier <fabien@symfony.com>
18
- */
19
- class DumpException extends RuntimeException
20
- {
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Exception/ExceptionInterface.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Exception;
13
-
14
- /**
15
- * Exception interface for all exceptions thrown by the component.
16
- *
17
- * @author Fabien Potencier <fabien@symfony.com>
18
- */
19
- interface ExceptionInterface
20
- {
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Exception/ParseException.php DELETED
@@ -1,144 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Exception;
13
-
14
- /**
15
- * Exception class thrown when an error occurs during parsing.
16
- *
17
- * @author Fabien Potencier <fabien@symfony.com>
18
- */
19
- class ParseException extends RuntimeException
20
- {
21
- private $parsedFile;
22
- private $parsedLine;
23
- private $snippet;
24
- private $rawMessage;
25
-
26
- /**
27
- * @param string $message The error message
28
- * @param int $parsedLine The line where the error occurred
29
- * @param string|null $snippet The snippet of code near the problem
30
- * @param string|null $parsedFile The file name where the error occurred
31
- * @param \Exception|null $previous The previous exception
32
- */
33
- public function __construct($message, $parsedLine = -1, $snippet = null, $parsedFile = null, \Exception $previous = null)
34
- {
35
- $this->parsedFile = $parsedFile;
36
- $this->parsedLine = $parsedLine;
37
- $this->snippet = $snippet;
38
- $this->rawMessage = $message;
39
-
40
- $this->updateRepr();
41
-
42
- parent::__construct($this->message, 0, $previous);
43
- }
44
-
45
- /**
46
- * Gets the snippet of code near the error.
47
- *
48
- * @return string The snippet of code
49
- */
50
- public function getSnippet()
51
- {
52
- return $this->snippet;
53
- }
54
-
55
- /**
56
- * Sets the snippet of code near the error.
57
- *
58
- * @param string $snippet The code snippet
59
- */
60
- public function setSnippet($snippet)
61
- {
62
- $this->snippet = $snippet;
63
-
64
- $this->updateRepr();
65
- }
66
-
67
- /**
68
- * Gets the filename where the error occurred.
69
- *
70
- * This method returns null if a string is parsed.
71
- *
72
- * @return string The filename
73
- */
74
- public function getParsedFile()
75
- {
76
- return $this->parsedFile;
77
- }
78
-
79
- /**
80
- * Sets the filename where the error occurred.
81
- *
82
- * @param string $parsedFile The filename
83
- */
84
- public function setParsedFile($parsedFile)
85
- {
86
- $this->parsedFile = $parsedFile;
87
-
88
- $this->updateRepr();
89
- }
90
-
91
- /**
92
- * Gets the line where the error occurred.
93
- *
94
- * @return int The file line
95
- */
96
- public function getParsedLine()
97
- {
98
- return $this->parsedLine;
99
- }
100
-
101
- /**
102
- * Sets the line where the error occurred.
103
- *
104
- * @param int $parsedLine The file line
105
- */
106
- public function setParsedLine($parsedLine)
107
- {
108
- $this->parsedLine = $parsedLine;
109
-
110
- $this->updateRepr();
111
- }
112
-
113
- private function updateRepr()
114
- {
115
- $this->message = $this->rawMessage;
116
-
117
- $dot = false;
118
- if ('.' === substr($this->message, -1)) {
119
- $this->message = substr($this->message, 0, -1);
120
- $dot = true;
121
- }
122
-
123
- if (null !== $this->parsedFile) {
124
- if (\PHP_VERSION_ID >= 50400) {
125
- $jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
126
- } else {
127
- $jsonOptions = 0;
128
- }
129
- $this->message .= sprintf(' in %s', json_encode($this->parsedFile, $jsonOptions));
130
- }
131
-
132
- if ($this->parsedLine >= 0) {
133
- $this->message .= sprintf(' at line %d', $this->parsedLine);
134
- }
135
-
136
- if ($this->snippet) {
137
- $this->message .= sprintf(' (near "%s")', $this->snippet);
138
- }
139
-
140
- if ($dot) {
141
- $this->message .= '.';
142
- }
143
- }
144
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Exception/RuntimeException.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Exception;
13
-
14
- /**
15
- * Exception class thrown when an error occurs during parsing.
16
- *
17
- * @author Romain Neutron <imprec@gmail.com>
18
- */
19
- class RuntimeException extends \RuntimeException implements ExceptionInterface
20
- {
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Inline.php DELETED
@@ -1,609 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml;
13
-
14
- use Symfony\Component\Yaml\Exception\DumpException;
15
- use Symfony\Component\Yaml\Exception\ParseException;
16
-
17
- /**
18
- * Inline implements a YAML parser/dumper for the YAML inline syntax.
19
- *
20
- * @author Fabien Potencier <fabien@symfony.com>
21
- */
22
- class Inline
23
- {
24
- const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')';
25
-
26
- private static $exceptionOnInvalidType = false;
27
- private static $objectSupport = false;
28
- private static $objectForMap = false;
29
-
30
- /**
31
- * Converts a YAML string to a PHP value.
32
- *
33
- * @param string $value A YAML string
34
- * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
35
- * @param bool $objectSupport True if object support is enabled, false otherwise
36
- * @param bool $objectForMap True if maps should return a stdClass instead of array()
37
- * @param array $references Mapping of variable names to values
38
- *
39
- * @return mixed A PHP value
40
- *
41
- * @throws ParseException
42
- */
43
- public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false, $references = array())
44
- {
45
- self::$exceptionOnInvalidType = $exceptionOnInvalidType;
46
- self::$objectSupport = $objectSupport;
47
- self::$objectForMap = $objectForMap;
48
-
49
- $value = trim($value);
50
-
51
- if ('' === $value) {
52
- return '';
53
- }
54
-
55
- if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) {
56
- $mbEncoding = mb_internal_encoding();
57
- mb_internal_encoding('ASCII');
58
- }
59
-
60
- $i = 0;
61
- switch ($value[0]) {
62
- case '[':
63
- $result = self::parseSequence($value, $i, $references);
64
- ++$i;
65
- break;
66
- case '{':
67
- $result = self::parseMapping($value, $i, $references);
68
- ++$i;
69
- break;
70
- default:
71
- $result = self::parseScalar($value, null, array('"', "'"), $i, true, $references);
72
- }
73
-
74
- // some comments are allowed at the end
75
- if (preg_replace('/\s+#.*$/A', '', substr($value, $i))) {
76
- throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)));
77
- }
78
-
79
- if (isset($mbEncoding)) {
80
- mb_internal_encoding($mbEncoding);
81
- }
82
-
83
- return $result;
84
- }
85
-
86
- /**
87
- * Dumps a given PHP variable to a YAML string.
88
- *
89
- * @param mixed $value The PHP variable to convert
90
- * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
91
- * @param bool $objectSupport True if object support is enabled, false otherwise
92
- *
93
- * @return string The YAML string representing the PHP value
94
- *
95
- * @throws DumpException When trying to dump PHP resource
96
- */
97
- public static function dump($value, $exceptionOnInvalidType = false, $objectSupport = false)
98
- {
99
- switch (true) {
100
- case \is_resource($value):
101
- if ($exceptionOnInvalidType) {
102
- throw new DumpException(sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_resource_type($value)));
103
- }
104
-
105
- return 'null';
106
- case \is_object($value):
107
- if ($objectSupport) {
108
- return '!php/object:'.serialize($value);
109
- }
110
-
111
- if ($exceptionOnInvalidType) {
112
- throw new DumpException('Object support when dumping a YAML file has been disabled.');
113
- }
114
-
115
- return 'null';
116
- case \is_array($value):
117
- return self::dumpArray($value, $exceptionOnInvalidType, $objectSupport);
118
- case null === $value:
119
- return 'null';
120
- case true === $value:
121
- return 'true';
122
- case false === $value:
123
- return 'false';
124
- case ctype_digit($value):
125
- return \is_string($value) ? "'$value'" : (int) $value;
126
- case is_numeric($value):
127
- $locale = setlocale(LC_NUMERIC, 0);
128
- if (false !== $locale) {
129
- setlocale(LC_NUMERIC, 'C');
130
- }
131
- if (\is_float($value)) {
132
- $repr = (string) $value;
133
- if (is_infinite($value)) {
134
- $repr = str_ireplace('INF', '.Inf', $repr);
135
- } elseif (floor($value) == $value && $repr == $value) {
136
- // Preserve float data type since storing a whole number will result in integer value.
137
- $repr = '!!float '.$repr;
138
- }
139
- } else {
140
- $repr = \is_string($value) ? "'$value'" : (string) $value;
141
- }
142
- if (false !== $locale) {
143
- setlocale(LC_NUMERIC, $locale);
144
- }
145
-
146
- return $repr;
147
- case '' == $value:
148
- return "''";
149
- case Escaper::requiresDoubleQuoting($value):
150
- return Escaper::escapeWithDoubleQuotes($value);
151
- case Escaper::requiresSingleQuoting($value):
152
- case Parser::preg_match(self::getHexRegex(), $value):
153
- case Parser::preg_match(self::getTimestampRegex(), $value):
154
- return Escaper::escapeWithSingleQuotes($value);
155
- default:
156
- return $value;
157
- }
158
- }
159
-
160
- /**
161
- * Check if given array is hash or just normal indexed array.
162
- *
163
- * @internal
164
- *
165
- * @param array $value The PHP array to check
166
- *
167
- * @return bool true if value is hash array, false otherwise
168
- */
169
- public static function isHash(array $value)
170
- {
171
- $expectedKey = 0;
172
-
173
- foreach ($value as $key => $val) {
174
- if ($key !== $expectedKey++) {
175
- return true;
176
- }
177
- }
178
-
179
- return false;
180
- }
181
-
182
- /**
183
- * Dumps a PHP array to a YAML string.
184
- *
185
- * @param array $value The PHP array to dump
186
- * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
187
- * @param bool $objectSupport True if object support is enabled, false otherwise
188
- *
189
- * @return string The YAML string representing the PHP array
190
- */
191
- private static function dumpArray($value, $exceptionOnInvalidType, $objectSupport)
192
- {
193
- // array
194
- if ($value && !self::isHash($value)) {
195
- $output = array();
196
- foreach ($value as $val) {
197
- $output[] = self::dump($val, $exceptionOnInvalidType, $objectSupport);
198
- }
199
-
200
- return sprintf('[%s]', implode(', ', $output));
201
- }
202
-
203
- // hash
204
- $output = array();
205
- foreach ($value as $key => $val) {
206
- $output[] = sprintf('%s: %s', self::dump($key, $exceptionOnInvalidType, $objectSupport), self::dump($val, $exceptionOnInvalidType, $objectSupport));
207
- }
208
-
209
- return sprintf('{ %s }', implode(', ', $output));
210
- }
211
-
212
- /**
213
- * Parses a YAML scalar.
214
- *
215
- * @param string $scalar
216
- * @param string[] $delimiters
217
- * @param string[] $stringDelimiters
218
- * @param int &$i
219
- * @param bool $evaluate
220
- * @param array $references
221
- *
222
- * @return string
223
- *
224
- * @throws ParseException When malformed inline YAML string is parsed
225
- *
226
- * @internal
227
- */
228
- public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true, $references = array())
229
- {
230
- if (\in_array($scalar[$i], $stringDelimiters)) {
231
- // quoted scalar
232
- $output = self::parseQuotedScalar($scalar, $i);
233
-
234
- if (null !== $delimiters) {
235
- $tmp = ltrim(substr($scalar, $i), ' ');
236
- if ('' === $tmp) {
237
- throw new ParseException(sprintf('Unexpected end of line, expected one of "%s".', implode('', $delimiters)));
238
- }
239
- if (!\in_array($tmp[0], $delimiters)) {
240
- throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i)));
241
- }
242
- }
243
- } else {
244
- // "normal" string
245
- if (!$delimiters) {
246
- $output = substr($scalar, $i);
247
- $i += \strlen($output);
248
-
249
- // remove comments
250
- if (Parser::preg_match('/[ \t]+#/', $output, $match, PREG_OFFSET_CAPTURE)) {
251
- $output = substr($output, 0, $match[0][1]);
252
- }
253
- } elseif (Parser::preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) {
254
- $output = $match[1];
255
- $i += \strlen($output);
256
- } else {
257
- throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar));
258
- }
259
-
260
- // a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
261
- if ($output && ('@' === $output[0] || '`' === $output[0] || '|' === $output[0] || '>' === $output[0])) {
262
- @trigger_error(sprintf('Not quoting the scalar "%s" starting with "%s" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', $output, $output[0]), E_USER_DEPRECATED);
263
-
264
- // to be thrown in 3.0
265
- // throw new ParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]));
266
- }
267
-
268
- if ($evaluate) {
269
- $output = self::evaluateScalar($output, $references);
270
- }
271
- }
272
-
273
- return $output;
274
- }
275
-
276
- /**
277
- * Parses a YAML quoted scalar.
278
- *
279
- * @param string $scalar
280
- * @param int &$i
281
- *
282
- * @return string
283
- *
284
- * @throws ParseException When malformed inline YAML string is parsed
285
- */
286
- private static function parseQuotedScalar($scalar, &$i)
287
- {
288
- if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
289
- throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i)));
290
- }
291
-
292
- $output = substr($match[0], 1, \strlen($match[0]) - 2);
293
-
294
- $unescaper = new Unescaper();
295
- if ('"' == $scalar[$i]) {
296
- $output = $unescaper->unescapeDoubleQuotedString($output);
297
- } else {
298
- $output = $unescaper->unescapeSingleQuotedString($output);
299
- }
300
-
301
- $i += \strlen($match[0]);
302
-
303
- return $output;
304
- }
305
-
306
- /**
307
- * Parses a YAML sequence.
308
- *
309
- * @param string $sequence
310
- * @param int &$i
311
- * @param array $references
312
- *
313
- * @return array
314
- *
315
- * @throws ParseException When malformed inline YAML string is parsed
316
- */
317
- private static function parseSequence($sequence, &$i = 0, $references = array())
318
- {
319
- $output = array();
320
- $len = \strlen($sequence);
321
- ++$i;
322
-
323
- // [foo, bar, ...]
324
- while ($i < $len) {
325
- switch ($sequence[$i]) {
326
- case '[':
327
- // nested sequence
328
- $output[] = self::parseSequence($sequence, $i, $references);
329
- break;
330
- case '{':
331
- // nested mapping
332
- $output[] = self::parseMapping($sequence, $i, $references);
333
- break;
334
- case ']':
335
- return $output;
336
- case ',':
337
- case ' ':
338
- break;
339
- default:
340
- $isQuoted = \in_array($sequence[$i], array('"', "'"));
341
- $value = self::parseScalar($sequence, array(',', ']'), array('"', "'"), $i, true, $references);
342
-
343
- // the value can be an array if a reference has been resolved to an array var
344
- if (!\is_array($value) && !$isQuoted && false !== strpos($value, ': ')) {
345
- // embedded mapping?
346
- try {
347
- $pos = 0;
348
- $value = self::parseMapping('{'.$value.'}', $pos, $references);
349
- } catch (\InvalidArgumentException $e) {
350
- // no, it's not
351
- }
352
- }
353
-
354
- $output[] = $value;
355
-
356
- --$i;
357
- }
358
-
359
- ++$i;
360
- }
361
-
362
- throw new ParseException(sprintf('Malformed inline YAML string: %s.', $sequence));
363
- }
364
-
365
- /**
366
- * Parses a YAML mapping.
367
- *
368
- * @param string $mapping
369
- * @param int &$i
370
- * @param array $references
371
- *
372
- * @return array|\stdClass
373
- *
374
- * @throws ParseException When malformed inline YAML string is parsed
375
- */
376
- private static function parseMapping($mapping, &$i = 0, $references = array())
377
- {
378
- $output = array();
379
- $len = \strlen($mapping);
380
- ++$i;
381
- $allowOverwrite = false;
382
-
383
- // {foo: bar, bar:foo, ...}
384
- while ($i < $len) {
385
- switch ($mapping[$i]) {
386
- case ' ':
387
- case ',':
388
- ++$i;
389
- continue 2;
390
- case '}':
391
- if (self::$objectForMap) {
392
- return (object) $output;
393
- }
394
-
395
- return $output;
396
- }
397
-
398
- // key
399
- $key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false);
400
-
401
- if ('<<' === $key) {
402
- $allowOverwrite = true;
403
- }
404
-
405
- // value
406
- $done = false;
407
-
408
- while ($i < $len) {
409
- switch ($mapping[$i]) {
410
- case '[':
411
- // nested sequence
412
- $value = self::parseSequence($mapping, $i, $references);
413
- // Spec: Keys MUST be unique; first one wins.
414
- // Parser cannot abort this mapping earlier, since lines
415
- // are processed sequentially.
416
- // But overwriting is allowed when a merge node is used in current block.
417
- if ('<<' === $key) {
418
- foreach ($value as $parsedValue) {
419
- $output += $parsedValue;
420
- }
421
- } elseif ($allowOverwrite || !isset($output[$key])) {
422
- $output[$key] = $value;
423
- }
424
- $done = true;
425
- break;
426
- case '{':
427
- // nested mapping
428
- $value = self::parseMapping($mapping, $i, $references);
429
- // Spec: Keys MUST be unique; first one wins.
430
- // Parser cannot abort this mapping earlier, since lines
431
- // are processed sequentially.
432
- // But overwriting is allowed when a merge node is used in current block.
433
- if ('<<' === $key) {
434
- $output += $value;
435
- } elseif ($allowOverwrite || !isset($output[$key])) {
436
- $output[$key] = $value;
437
- }
438
- $done = true;
439
- break;
440
- case ':':
441
- case ' ':
442
- break;
443
- default:
444
- $value = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i, true, $references);
445
- // Spec: Keys MUST be unique; first one wins.
446
- // Parser cannot abort this mapping earlier, since lines
447
- // are processed sequentially.
448
- // But overwriting is allowed when a merge node is used in current block.
449
- if ('<<' === $key) {
450
- $output += $value;
451
- } elseif ($allowOverwrite || !isset($output[$key])) {
452
- $output[$key] = $value;
453
- }
454
- $done = true;
455
- --$i;
456
- }
457
-
458
- ++$i;
459
-
460
- if ($done) {
461
- continue 2;
462
- }
463
- }
464
- }
465
-
466
- throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping));
467
- }
468
-
469
- /**
470
- * Evaluates scalars and replaces magic values.
471
- *
472
- * @param string $scalar
473
- * @param array $references
474
- *
475
- * @return mixed The evaluated YAML string
476
- *
477
- * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved
478
- */
479
- private static function evaluateScalar($scalar, $references = array())
480
- {
481
- $scalar = trim($scalar);
482
- $scalarLower = strtolower($scalar);
483
-
484
- if (0 === strpos($scalar, '*')) {
485
- if (false !== $pos = strpos($scalar, '#')) {
486
- $value = substr($scalar, 1, $pos - 2);
487
- } else {
488
- $value = substr($scalar, 1);
489
- }
490
-
491
- // an unquoted *
492
- if (false === $value || '' === $value) {
493
- throw new ParseException('A reference must contain at least one character.');
494
- }
495
-
496
- if (!array_key_exists($value, $references)) {
497
- throw new ParseException(sprintf('Reference "%s" does not exist.', $value));
498
- }
499
-
500
- return $references[$value];
501
- }
502
-
503
- switch (true) {
504
- case 'null' === $scalarLower:
505
- case '' === $scalar:
506
- case '~' === $scalar:
507
- return;
508
- case 'true' === $scalarLower:
509
- return true;
510
- case 'false' === $scalarLower:
511
- return false;
512
- // Optimise for returning strings.
513
- case '+' === $scalar[0] || '-' === $scalar[0] || '.' === $scalar[0] || '!' === $scalar[0] || is_numeric($scalar[0]):
514
- switch (true) {
515
- case 0 === strpos($scalar, '!str'):
516
- return (string) substr($scalar, 5);
517
- case 0 === strpos($scalar, '! '):
518
- return (int) self::parseScalar(substr($scalar, 2));
519
- case 0 === strpos($scalar, '!php/object:'):
520
- if (self::$objectSupport) {
521
- return unserialize(substr($scalar, 12));
522
- }
523
-
524
- if (self::$exceptionOnInvalidType) {
525
- throw new ParseException('Object support when parsing a YAML file has been disabled.');
526
- }
527
-
528
- return;
529
- case 0 === strpos($scalar, '!!php/object:'):
530
- if (self::$objectSupport) {
531
- return unserialize(substr($scalar, 13));
532
- }
533
-
534
- if (self::$exceptionOnInvalidType) {
535
- throw new ParseException('Object support when parsing a YAML file has been disabled.');
536
- }
537
-
538
- return;
539
- case 0 === strpos($scalar, '!!float '):
540
- return (float) substr($scalar, 8);
541
- case ctype_digit($scalar):
542
- $raw = $scalar;
543
- $cast = (int) $scalar;
544
-
545
- return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
546
- case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)):
547
- $raw = $scalar;
548
- $cast = (int) $scalar;
549
-
550
- return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw === (string) $cast) ? $cast : $raw);
551
- case is_numeric($scalar):
552
- case Parser::preg_match(self::getHexRegex(), $scalar):
553
- return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar;
554
- case '.inf' === $scalarLower:
555
- case '.nan' === $scalarLower:
556
- return -log(0);
557
- case '-.inf' === $scalarLower:
558
- return log(0);
559
- case Parser::preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar):
560
- return (float) str_replace(',', '', $scalar);
561
- case Parser::preg_match(self::getTimestampRegex(), $scalar):
562
- $timeZone = date_default_timezone_get();
563
- date_default_timezone_set('UTC');
564
- $time = strtotime($scalar);
565
- date_default_timezone_set($timeZone);
566
-
567
- return $time;
568
- }
569
- // no break
570
- default:
571
- return (string) $scalar;
572
- }
573
- }
574
-
575
- /**
576
- * Gets a regex that matches a YAML date.
577
- *
578
- * @return string The regular expression
579
- *
580
- * @see http://www.yaml.org/spec/1.2/spec.html#id2761573
581
- */
582
- private static function getTimestampRegex()
583
- {
584
- return <<<EOF
585
- ~^
586
- (?P<year>[0-9][0-9][0-9][0-9])
587
- -(?P<month>[0-9][0-9]?)
588
- -(?P<day>[0-9][0-9]?)
589
- (?:(?:[Tt]|[ \t]+)
590
- (?P<hour>[0-9][0-9]?)
591
- :(?P<minute>[0-9][0-9])
592
- :(?P<second>[0-9][0-9])
593
- (?:\.(?P<fraction>[0-9]*))?
594
- (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?)
595
- (?::(?P<tz_minute>[0-9][0-9]))?))?)?
596
- $~x
597
- EOF;
598
- }
599
-
600
- /**
601
- * Gets a regex that matches a YAML number in hexadecimal notation.
602
- *
603
- * @return string
604
- */
605
- private static function getHexRegex()
606
- {
607
- return '~^0x[0-9a-f]++$~i';
608
- }
609
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2004-2018 Fabien Potencier
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is furnished
8
- to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Parser.php DELETED
@@ -1,852 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml;
13
-
14
- use Symfony\Component\Yaml\Exception\ParseException;
15
-
16
- /**
17
- * Parser parses YAML strings to convert them to PHP arrays.
18
- *
19
- * @author Fabien Potencier <fabien@symfony.com>
20
- */
21
- class Parser
22
- {
23
- const BLOCK_SCALAR_HEADER_PATTERN = '(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?';
24
- // BC - wrongly named
25
- const FOLDED_SCALAR_PATTERN = self::BLOCK_SCALAR_HEADER_PATTERN;
26
-
27
- private $offset = 0;
28
- private $totalNumberOfLines;
29
- private $lines = array();
30
- private $currentLineNb = -1;
31
- private $currentLine = '';
32
- private $refs = array();
33
- private $skippedLineNumbers = array();
34
- private $locallySkippedLineNumbers = array();
35
-
36
- /**
37
- * @param int $offset The offset of YAML document (used for line numbers in error messages)
38
- * @param int|null $totalNumberOfLines The overall number of lines being parsed
39
- * @param int[] $skippedLineNumbers Number of comment lines that have been skipped by the parser
40
- */
41
- public function __construct($offset = 0, $totalNumberOfLines = null, array $skippedLineNumbers = array())
42
- {
43
- $this->offset = $offset;
44
- $this->totalNumberOfLines = $totalNumberOfLines;
45
- $this->skippedLineNumbers = $skippedLineNumbers;
46
- }
47
-
48
- /**
49
- * Parses a YAML string to a PHP value.
50
- *
51
- * @param string $value A YAML string
52
- * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
53
- * @param bool $objectSupport True if object support is enabled, false otherwise
54
- * @param bool $objectForMap True if maps should return a stdClass instead of array()
55
- *
56
- * @return mixed A PHP value
57
- *
58
- * @throws ParseException If the YAML is not valid
59
- */
60
- public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false)
61
- {
62
- if (false === preg_match('//u', $value)) {
63
- throw new ParseException('The YAML value does not appear to be valid UTF-8.');
64
- }
65
-
66
- $this->refs = array();
67
-
68
- $mbEncoding = null;
69
- $e = null;
70
- $data = null;
71
-
72
- if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) {
73
- $mbEncoding = mb_internal_encoding();
74
- mb_internal_encoding('UTF-8');
75
- }
76
-
77
- try {
78
- $data = $this->doParse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap);
79
- } catch (\Exception $e) {
80
- } catch (\Throwable $e) {
81
- }
82
-
83
- if (null !== $mbEncoding) {
84
- mb_internal_encoding($mbEncoding);
85
- }
86
-
87
- $this->lines = array();
88
- $this->currentLine = '';
89
- $this->refs = array();
90
- $this->skippedLineNumbers = array();
91
- $this->locallySkippedLineNumbers = array();
92
-
93
- if (null !== $e) {
94
- throw $e;
95
- }
96
-
97
- return $data;
98
- }
99
-
100
- private function doParse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false)
101
- {
102
- $this->currentLineNb = -1;
103
- $this->currentLine = '';
104
- $value = $this->cleanup($value);
105
- $this->lines = explode("\n", $value);
106
- $this->locallySkippedLineNumbers = array();
107
-
108
- if (null === $this->totalNumberOfLines) {
109
- $this->totalNumberOfLines = \count($this->lines);
110
- }
111
-
112
- $data = array();
113
- $context = null;
114
- $allowOverwrite = false;
115
-
116
- while ($this->moveToNextLine()) {
117
- if ($this->isCurrentLineEmpty()) {
118
- continue;
119
- }
120
-
121
- // tab?
122
- if ("\t" === $this->currentLine[0]) {
123
- throw new ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
124
- }
125
-
126
- $isRef = $mergeNode = false;
127
- if (self::preg_match('#^\-((?P<leadspaces>\s+)(?P<value>.+))?$#u', rtrim($this->currentLine), $values)) {
128
- if ($context && 'mapping' == $context) {
129
- throw new ParseException('You cannot define a sequence item when in a mapping', $this->getRealCurrentLineNb() + 1, $this->currentLine);
130
- }
131
- $context = 'sequence';
132
-
133
- if (isset($values['value']) && self::preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) {
134
- $isRef = $matches['ref'];
135
- $values['value'] = $matches['value'];
136
- }
137
-
138
- // array
139
- if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) {
140
- $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap);
141
- } else {
142
- if (isset($values['leadspaces'])
143
- && self::preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+))?$#u', rtrim($values['value']), $matches)
144
- ) {
145
- // this is a compact notation element, add to next block and parse
146
- $block = $values['value'];
147
- if ($this->isNextLineIndented()) {
148
- $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1);
149
- }
150
-
151
- $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $exceptionOnInvalidType, $objectSupport, $objectForMap);
152
- } else {
153
- $data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport, $objectForMap, $context);
154
- }
155
- }
156
- if ($isRef) {
157
- $this->refs[$isRef] = end($data);
158
- }
159
- } elseif (
160
- self::preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+))?$#u', rtrim($this->currentLine), $values)
161
- && (false === strpos($values['key'], ' #') || \in_array($values['key'][0], array('"', "'")))
162
- ) {
163
- if ($context && 'sequence' == $context) {
164
- throw new ParseException('You cannot define a mapping item when in a sequence', $this->currentLineNb + 1, $this->currentLine);
165
- }
166
- $context = 'mapping';
167
-
168
- // force correct settings
169
- Inline::parse(null, $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
170
- try {
171
- $key = Inline::parseScalar($values['key']);
172
- } catch (ParseException $e) {
173
- $e->setParsedLine($this->getRealCurrentLineNb() + 1);
174
- $e->setSnippet($this->currentLine);
175
-
176
- throw $e;
177
- }
178
-
179
- // Convert float keys to strings, to avoid being converted to integers by PHP
180
- if (\is_float($key)) {
181
- $key = (string) $key;
182
- }
183
-
184
- if ('<<' === $key && (!isset($values['value']) || !self::preg_match('#^&(?P<ref>[^ ]+)#u', $values['value'], $refMatches))) {
185
- $mergeNode = true;
186
- $allowOverwrite = true;
187
- if (isset($values['value']) && 0 === strpos($values['value'], '*')) {
188
- $refName = substr($values['value'], 1);
189
- if (!array_key_exists($refName, $this->refs)) {
190
- throw new ParseException(sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine);
191
- }
192
-
193
- $refValue = $this->refs[$refName];
194
-
195
- if (!\is_array($refValue)) {
196
- throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
197
- }
198
-
199
- $data += $refValue; // array union
200
- } else {
201
- if (isset($values['value']) && '' !== $values['value']) {
202
- $value = $values['value'];
203
- } else {
204
- $value = $this->getNextEmbedBlock();
205
- }
206
- $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $exceptionOnInvalidType, $objectSupport, $objectForMap);
207
-
208
- if (!\is_array($parsed)) {
209
- throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
210
- }
211
-
212
- if (isset($parsed[0])) {
213
- // If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes
214
- // and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier
215
- // in the sequence override keys specified in later mapping nodes.
216
- foreach ($parsed as $parsedItem) {
217
- if (!\is_array($parsedItem)) {
218
- throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem);
219
- }
220
-
221
- $data += $parsedItem; // array union
222
- }
223
- } else {
224
- // If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the
225
- // current mapping, unless the key already exists in it.
226
- $data += $parsed; // array union
227
- }
228
- }
229
- } elseif ('<<' !== $key && isset($values['value']) && self::preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) {
230
- $isRef = $matches['ref'];
231
- $values['value'] = $matches['value'];
232
- }
233
-
234
- if ($mergeNode) {
235
- // Merge keys
236
- } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#') || '<<' === $key) {
237
- // hash
238
- // if next line is less indented or equal, then it means that the current value is null
239
- if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) {
240
- // Spec: Keys MUST be unique; first one wins.
241
- // But overwriting is allowed when a merge node is used in current block.
242
- if ($allowOverwrite || !isset($data[$key])) {
243
- $data[$key] = null;
244
- }
245
- } else {
246
- $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap);
247
-
248
- if ('<<' === $key) {
249
- $this->refs[$refMatches['ref']] = $value;
250
- $data += $value;
251
- } elseif ($allowOverwrite || !isset($data[$key])) {
252
- // Spec: Keys MUST be unique; first one wins.
253
- // But overwriting is allowed when a merge node is used in current block.
254
- $data[$key] = $value;
255
- }
256
- }
257
- } else {
258
- $value = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport, $objectForMap, $context);
259
- // Spec: Keys MUST be unique; first one wins.
260
- // But overwriting is allowed when a merge node is used in current block.
261
- if ($allowOverwrite || !isset($data[$key])) {
262
- $data[$key] = $value;
263
- }
264
- }
265
- if ($isRef) {
266
- $this->refs[$isRef] = $data[$key];
267
- }
268
- } else {
269
- // multiple documents are not supported
270
- if ('---' === $this->currentLine) {
271
- throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine);
272
- }
273
-
274
- // 1-liner optionally followed by newline(s)
275
- if (\is_string($value) && $this->lines[0] === trim($value)) {
276
- try {
277
- $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
278
- } catch (ParseException $e) {
279
- $e->setParsedLine($this->getRealCurrentLineNb() + 1);
280
- $e->setSnippet($this->currentLine);
281
-
282
- throw $e;
283
- }
284
-
285
- return $value;
286
- }
287
-
288
- throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
289
- }
290
- }
291
-
292
- if ($objectForMap && !\is_object($data) && 'mapping' === $context) {
293
- $object = new \stdClass();
294
-
295
- foreach ($data as $key => $value) {
296
- $object->$key = $value;
297
- }
298
-
299
- $data = $object;
300
- }
301
-
302
- return empty($data) ? null : $data;
303
- }
304
-
305
- private function parseBlock($offset, $yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap)
306
- {
307
- $skippedLineNumbers = $this->skippedLineNumbers;
308
-
309
- foreach ($this->locallySkippedLineNumbers as $lineNumber) {
310
- if ($lineNumber < $offset) {
311
- continue;
312
- }
313
-
314
- $skippedLineNumbers[] = $lineNumber;
315
- }
316
-
317
- $parser = new self($offset, $this->totalNumberOfLines, $skippedLineNumbers);
318
- $parser->refs = &$this->refs;
319
-
320
- return $parser->doParse($yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap);
321
- }
322
-
323
- /**
324
- * Returns the current line number (takes the offset into account).
325
- *
326
- * @return int The current line number
327
- */
328
- private function getRealCurrentLineNb()
329
- {
330
- $realCurrentLineNumber = $this->currentLineNb + $this->offset;
331
-
332
- foreach ($this->skippedLineNumbers as $skippedLineNumber) {
333
- if ($skippedLineNumber > $realCurrentLineNumber) {
334
- break;
335
- }
336
-
337
- ++$realCurrentLineNumber;
338
- }
339
-
340
- return $realCurrentLineNumber;
341
- }
342
-
343
- /**
344
- * Returns the current line indentation.
345
- *
346
- * @return int The current line indentation
347
- */
348
- private function getCurrentLineIndentation()
349
- {
350
- return \strlen($this->currentLine) - \strlen(ltrim($this->currentLine, ' '));
351
- }
352
-
353
- /**
354
- * Returns the next embed block of YAML.
355
- *
356
- * @param int $indentation The indent level at which the block is to be read, or null for default
357
- * @param bool $inSequence True if the enclosing data structure is a sequence
358
- *
359
- * @return string A YAML string
360
- *
361
- * @throws ParseException When indentation problem are detected
362
- */
363
- private function getNextEmbedBlock($indentation = null, $inSequence = false)
364
- {
365
- $oldLineIndentation = $this->getCurrentLineIndentation();
366
- $blockScalarIndentations = array();
367
-
368
- if ($this->isBlockScalarHeader()) {
369
- $blockScalarIndentations[] = $this->getCurrentLineIndentation();
370
- }
371
-
372
- if (!$this->moveToNextLine()) {
373
- return;
374
- }
375
-
376
- if (null === $indentation) {
377
- $newIndent = $this->getCurrentLineIndentation();
378
-
379
- $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem();
380
-
381
- if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) {
382
- throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
383
- }
384
- } else {
385
- $newIndent = $indentation;
386
- }
387
-
388
- $data = array();
389
- if ($this->getCurrentLineIndentation() >= $newIndent) {
390
- $data[] = substr($this->currentLine, $newIndent);
391
- } else {
392
- $this->moveToPreviousLine();
393
-
394
- return;
395
- }
396
-
397
- if ($inSequence && $oldLineIndentation === $newIndent && isset($data[0][0]) && '-' === $data[0][0]) {
398
- // the previous line contained a dash but no item content, this line is a sequence item with the same indentation
399
- // and therefore no nested list or mapping
400
- $this->moveToPreviousLine();
401
-
402
- return;
403
- }
404
-
405
- $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
406
-
407
- if (empty($blockScalarIndentations) && $this->isBlockScalarHeader()) {
408
- $blockScalarIndentations[] = $this->getCurrentLineIndentation();
409
- }
410
-
411
- $previousLineIndentation = $this->getCurrentLineIndentation();
412
-
413
- while ($this->moveToNextLine()) {
414
- $indent = $this->getCurrentLineIndentation();
415
-
416
- // terminate all block scalars that are more indented than the current line
417
- if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && '' !== trim($this->currentLine)) {
418
- foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
419
- if ($blockScalarIndentation >= $this->getCurrentLineIndentation()) {
420
- unset($blockScalarIndentations[$key]);
421
- }
422
- }
423
- }
424
-
425
- if (empty($blockScalarIndentations) && !$this->isCurrentLineComment() && $this->isBlockScalarHeader()) {
426
- $blockScalarIndentations[] = $this->getCurrentLineIndentation();
427
- }
428
-
429
- $previousLineIndentation = $indent;
430
-
431
- if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) {
432
- $this->moveToPreviousLine();
433
- break;
434
- }
435
-
436
- if ($this->isCurrentLineBlank()) {
437
- $data[] = substr($this->currentLine, $newIndent);
438
- continue;
439
- }
440
-
441
- // we ignore "comment" lines only when we are not inside a scalar block
442
- if (empty($blockScalarIndentations) && $this->isCurrentLineComment()) {
443
- // remember ignored comment lines (they are used later in nested
444
- // parser calls to determine real line numbers)
445
- //
446
- // CAUTION: beware to not populate the global property here as it
447
- // will otherwise influence the getRealCurrentLineNb() call here
448
- // for consecutive comment lines and subsequent embedded blocks
449
- $this->locallySkippedLineNumbers[] = $this->getRealCurrentLineNb();
450
-
451
- continue;
452
- }
453
-
454
- if ($indent >= $newIndent) {
455
- $data[] = substr($this->currentLine, $newIndent);
456
- } elseif (0 == $indent) {
457
- $this->moveToPreviousLine();
458
-
459
- break;
460
- } else {
461
- throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
462
- }
463
- }
464
-
465
- return implode("\n", $data);
466
- }
467
-
468
- /**
469
- * Moves the parser to the next line.
470
- *
471
- * @return bool
472
- */
473
- private function moveToNextLine()
474
- {
475
- if ($this->currentLineNb >= \count($this->lines) - 1) {
476
- return false;
477
- }
478
-
479
- $this->currentLine = $this->lines[++$this->currentLineNb];
480
-
481
- return true;
482
- }
483
-
484
- /**
485
- * Moves the parser to the previous line.
486
- *
487
- * @return bool
488
- */
489
- private function moveToPreviousLine()
490
- {
491
- if ($this->currentLineNb < 1) {
492
- return false;
493
- }
494
-
495
- $this->currentLine = $this->lines[--$this->currentLineNb];
496
-
497
- return true;
498
- }
499
-
500
- /**
501
- * Parses a YAML value.
502
- *
503
- * @param string $value A YAML value
504
- * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise
505
- * @param bool $objectSupport True if object support is enabled, false otherwise
506
- * @param bool $objectForMap True if maps should return a stdClass instead of array()
507
- * @param string $context The parser context (either sequence or mapping)
508
- *
509
- * @return mixed A PHP value
510
- *
511
- * @throws ParseException When reference does not exist
512
- */
513
- private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $objectForMap, $context)
514
- {
515
- if (0 === strpos($value, '*')) {
516
- if (false !== $pos = strpos($value, '#')) {
517
- $value = substr($value, 1, $pos - 2);
518
- } else {
519
- $value = substr($value, 1);
520
- }
521
-
522
- if (!array_key_exists($value, $this->refs)) {
523
- throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine);
524
- }
525
-
526
- return $this->refs[$value];
527
- }
528
-
529
- if (self::preg_match('/^'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) {
530
- $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
531
-
532
- return $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers));
533
- }
534
-
535
- try {
536
- $parsedValue = Inline::parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
537
-
538
- if ('mapping' === $context && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && false !== strpos($parsedValue, ': ')) {
539
- @trigger_error(sprintf('Using a colon in the unquoted mapping value "%s" in line %d is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', $value, $this->getRealCurrentLineNb() + 1), E_USER_DEPRECATED);
540
-
541
- // to be thrown in 3.0
542
- // throw new ParseException('A colon cannot be used in an unquoted mapping value.');
543
- }
544
-
545
- return $parsedValue;
546
- } catch (ParseException $e) {
547
- $e->setParsedLine($this->getRealCurrentLineNb() + 1);
548
- $e->setSnippet($this->currentLine);
549
-
550
- throw $e;
551
- }
552
- }
553
-
554
- /**
555
- * Parses a block scalar.
556
- *
557
- * @param string $style The style indicator that was used to begin this block scalar (| or >)
558
- * @param string $chomping The chomping indicator that was used to begin this block scalar (+ or -)
559
- * @param int $indentation The indentation indicator that was used to begin this block scalar
560
- *
561
- * @return string The text value
562
- */
563
- private function parseBlockScalar($style, $chomping = '', $indentation = 0)
564
- {
565
- $notEOF = $this->moveToNextLine();
566
- if (!$notEOF) {
567
- return '';
568
- }
569
-
570
- $isCurrentLineBlank = $this->isCurrentLineBlank();
571
- $blockLines = array();
572
-
573
- // leading blank lines are consumed before determining indentation
574
- while ($notEOF && $isCurrentLineBlank) {
575
- // newline only if not EOF
576
- if ($notEOF = $this->moveToNextLine()) {
577
- $blockLines[] = '';
578
- $isCurrentLineBlank = $this->isCurrentLineBlank();
579
- }
580
- }
581
-
582
- // determine indentation if not specified
583
- if (0 === $indentation) {
584
- if (self::preg_match('/^ +/', $this->currentLine, $matches)) {
585
- $indentation = \strlen($matches[0]);
586
- }
587
- }
588
-
589
- if ($indentation > 0) {
590
- $pattern = sprintf('/^ {%d}(.*)$/', $indentation);
591
-
592
- while (
593
- $notEOF && (
594
- $isCurrentLineBlank ||
595
- self::preg_match($pattern, $this->currentLine, $matches)
596
- )
597
- ) {
598
- if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) {
599
- $blockLines[] = substr($this->currentLine, $indentation);
600
- } elseif ($isCurrentLineBlank) {
601
- $blockLines[] = '';
602
- } else {
603
- $blockLines[] = $matches[1];
604
- }
605
-
606
- // newline only if not EOF
607
- if ($notEOF = $this->moveToNextLine()) {
608
- $isCurrentLineBlank = $this->isCurrentLineBlank();
609
- }
610
- }
611
- } elseif ($notEOF) {
612
- $blockLines[] = '';
613
- }
614
-
615
- if ($notEOF) {
616
- $blockLines[] = '';
617
- $this->moveToPreviousLine();
618
- } elseif (!$notEOF && !$this->isCurrentLineLastLineInDocument()) {
619
- $blockLines[] = '';
620
- }
621
-
622
- // folded style
623
- if ('>' === $style) {
624
- $text = '';
625
- $previousLineIndented = false;
626
- $previousLineBlank = false;
627
-
628
- for ($i = 0, $blockLinesCount = \count($blockLines); $i < $blockLinesCount; ++$i) {
629
- if ('' === $blockLines[$i]) {
630
- $text .= "\n";
631
- $previousLineIndented = false;
632
- $previousLineBlank = true;
633
- } elseif (' ' === $blockLines[$i][0]) {
634
- $text .= "\n".$blockLines[$i];
635
- $previousLineIndented = true;
636
- $previousLineBlank = false;
637
- } elseif ($previousLineIndented) {
638
- $text .= "\n".$blockLines[$i];
639
- $previousLineIndented = false;
640
- $previousLineBlank = false;
641
- } elseif ($previousLineBlank || 0 === $i) {
642
- $text .= $blockLines[$i];
643
- $previousLineIndented = false;
644
- $previousLineBlank = false;
645
- } else {
646
- $text .= ' '.$blockLines[$i];
647
- $previousLineIndented = false;
648
- $previousLineBlank = false;
649
- }
650
- }
651
- } else {
652
- $text = implode("\n", $blockLines);
653
- }
654
-
655
- // deal with trailing newlines
656
- if ('' === $chomping) {
657
- $text = preg_replace('/\n+$/', "\n", $text);
658
- } elseif ('-' === $chomping) {
659
- $text = preg_replace('/\n+$/', '', $text);
660
- }
661
-
662
- return $text;
663
- }
664
-
665
- /**
666
- * Returns true if the next line is indented.
667
- *
668
- * @return bool Returns true if the next line is indented, false otherwise
669
- */
670
- private function isNextLineIndented()
671
- {
672
- $currentIndentation = $this->getCurrentLineIndentation();
673
- $EOF = !$this->moveToNextLine();
674
-
675
- while (!$EOF && $this->isCurrentLineEmpty()) {
676
- $EOF = !$this->moveToNextLine();
677
- }
678
-
679
- if ($EOF) {
680
- return false;
681
- }
682
-
683
- $ret = $this->getCurrentLineIndentation() > $currentIndentation;
684
-
685
- $this->moveToPreviousLine();
686
-
687
- return $ret;
688
- }
689
-
690
- /**
691
- * Returns true if the current line is blank or if it is a comment line.
692
- *
693
- * @return bool Returns true if the current line is empty or if it is a comment line, false otherwise
694
- */
695
- private function isCurrentLineEmpty()
696
- {
697
- return $this->isCurrentLineBlank() || $this->isCurrentLineComment();
698
- }
699
-
700
- /**
701
- * Returns true if the current line is blank.
702
- *
703
- * @return bool Returns true if the current line is blank, false otherwise
704
- */
705
- private function isCurrentLineBlank()
706
- {
707
- return '' == trim($this->currentLine, ' ');
708
- }
709
-
710
- /**
711
- * Returns true if the current line is a comment line.
712
- *
713
- * @return bool Returns true if the current line is a comment line, false otherwise
714
- */
715
- private function isCurrentLineComment()
716
- {
717
- //checking explicitly the first char of the trim is faster than loops or strpos
718
- $ltrimmedLine = ltrim($this->currentLine, ' ');
719
-
720
- return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0];
721
- }
722
-
723
- private function isCurrentLineLastLineInDocument()
724
- {
725
- return ($this->offset + $this->currentLineNb) >= ($this->totalNumberOfLines - 1);
726
- }
727
-
728
- /**
729
- * Cleanups a YAML string to be parsed.
730
- *
731
- * @param string $value The input YAML string
732
- *
733
- * @return string A cleaned up YAML string
734
- */
735
- private function cleanup($value)
736
- {
737
- $value = str_replace(array("\r\n", "\r"), "\n", $value);
738
-
739
- // strip YAML header
740
- $count = 0;
741
- $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count);
742
- $this->offset += $count;
743
-
744
- // remove leading comments
745
- $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count);
746
- if (1 == $count) {
747
- // items have been removed, update the offset
748
- $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
749
- $value = $trimmedValue;
750
- }
751
-
752
- // remove start of the document marker (---)
753
- $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count);
754
- if (1 == $count) {
755
- // items have been removed, update the offset
756
- $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
757
- $value = $trimmedValue;
758
-
759
- // remove end of the document marker (...)
760
- $value = preg_replace('#\.\.\.\s*$#', '', $value);
761
- }
762
-
763
- return $value;
764
- }
765
-
766
- /**
767
- * Returns true if the next line starts unindented collection.
768
- *
769
- * @return bool Returns true if the next line starts unindented collection, false otherwise
770
- */
771
- private function isNextLineUnIndentedCollection()
772
- {
773
- $currentIndentation = $this->getCurrentLineIndentation();
774
- $notEOF = $this->moveToNextLine();
775
-
776
- while ($notEOF && $this->isCurrentLineEmpty()) {
777
- $notEOF = $this->moveToNextLine();
778
- }
779
-
780
- if (false === $notEOF) {
781
- return false;
782
- }
783
-
784
- $ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem();
785
-
786
- $this->moveToPreviousLine();
787
-
788
- return $ret;
789
- }
790
-
791
- /**
792
- * Returns true if the string is un-indented collection item.
793
- *
794
- * @return bool Returns true if the string is un-indented collection item, false otherwise
795
- */
796
- private function isStringUnIndentedCollectionItem()
797
- {
798
- return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- ');
799
- }
800
-
801
- /**
802
- * Tests whether or not the current line is the header of a block scalar.
803
- *
804
- * @return bool
805
- */
806
- private function isBlockScalarHeader()
807
- {
808
- return (bool) self::preg_match('~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~', $this->currentLine);
809
- }
810
-
811
- /**
812
- * A local wrapper for `preg_match` which will throw a ParseException if there
813
- * is an internal error in the PCRE engine.
814
- *
815
- * This avoids us needing to check for "false" every time PCRE is used
816
- * in the YAML engine
817
- *
818
- * @throws ParseException on a PCRE internal error
819
- *
820
- * @see preg_last_error()
821
- *
822
- * @internal
823
- */
824
- public static function preg_match($pattern, $subject, &$matches = null, $flags = 0, $offset = 0)
825
- {
826
- if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) {
827
- switch (preg_last_error()) {
828
- case PREG_INTERNAL_ERROR:
829
- $error = 'Internal PCRE error.';
830
- break;
831
- case PREG_BACKTRACK_LIMIT_ERROR:
832
- $error = 'pcre.backtrack_limit reached.';
833
- break;
834
- case PREG_RECURSION_LIMIT_ERROR:
835
- $error = 'pcre.recursion_limit reached.';
836
- break;
837
- case PREG_BAD_UTF8_ERROR:
838
- $error = 'Malformed UTF-8 data.';
839
- break;
840
- case PREG_BAD_UTF8_OFFSET_ERROR:
841
- $error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point.';
842
- break;
843
- default:
844
- $error = 'Error.';
845
- }
846
-
847
- throw new ParseException($error);
848
- }
849
-
850
- return $ret;
851
- }
852
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/README.md DELETED
@@ -1,13 +0,0 @@
1
- Yaml Component
2
- ==============
3
-
4
- The Yaml component loads and dumps YAML files.
5
-
6
- Resources
7
- ---------
8
-
9
- * [Documentation](https://symfony.com/doc/current/components/yaml/index.html)
10
- * [Contributing](https://symfony.com/doc/current/contributing/index.html)
11
- * [Report issues](https://github.com/symfony/symfony/issues) and
12
- [send Pull Requests](https://github.com/symfony/symfony/pulls)
13
- in the [main Symfony repository](https://github.com/symfony/symfony)
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/DumperTest.php DELETED
@@ -1,257 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Tests;
13
-
14
- use PHPUnit\Framework\TestCase;
15
- use Symfony\Component\Yaml\Dumper;
16
- use Symfony\Component\Yaml\Parser;
17
-
18
- class DumperTest extends TestCase
19
- {
20
- protected $parser;
21
- protected $dumper;
22
- protected $path;
23
-
24
- protected $array = array(
25
- '' => 'bar',
26
- 'foo' => '#bar',
27
- 'foo\'bar' => array(),
28
- 'bar' => array(1, 'foo'),
29
- 'foobar' => array(
30
- 'foo' => 'bar',
31
- 'bar' => array(1, 'foo'),
32
- 'foobar' => array(
33
- 'foo' => 'bar',
34
- 'bar' => array(1, 'foo'),
35
- ),
36
- ),
37
- );
38
-
39
- protected function setUp()
40
- {
41
- $this->parser = new Parser();
42
- $this->dumper = new Dumper();
43
- $this->path = __DIR__.'/Fixtures';
44
- }
45
-
46
- protected function tearDown()
47
- {
48
- $this->parser = null;
49
- $this->dumper = null;
50
- $this->path = null;
51
- $this->array = null;
52
- }
53
-
54
- public function testSetIndentation()
55
- {
56
- $this->dumper->setIndentation(7);
57
-
58
- $expected = <<<'EOF'
59
- '': bar
60
- foo: '#bar'
61
- 'foo''bar': { }
62
- bar:
63
- - 1
64
- - foo
65
- foobar:
66
- foo: bar
67
- bar:
68
- - 1
69
- - foo
70
- foobar:
71
- foo: bar
72
- bar:
73
- - 1
74
- - foo
75
-
76
- EOF;
77
- $this->assertEquals($expected, $this->dumper->dump($this->array, 4, 0));
78
- }
79
-
80
- public function testSpecifications()
81
- {
82
- $files = $this->parser->parse(file_get_contents($this->path.'/index.yml'));
83
- foreach ($files as $file) {
84
- $yamls = file_get_contents($this->path.'/'.$file.'.yml');
85
-
86
- // split YAMLs documents
87
- foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) {
88
- if (!$yaml) {
89
- continue;
90
- }
91
-
92
- $test = $this->parser->parse($yaml);
93
- if (isset($test['dump_skip']) && $test['dump_skip']) {
94
- continue;
95
- } elseif (isset($test['todo']) && $test['todo']) {
96
- // TODO
97
- } else {
98
- eval('$expected = '.trim($test['php']).';');
99
- $this->assertSame($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']);
100
- }
101
- }
102
- }
103
- }
104
-
105
- public function testInlineLevel()
106
- {
107
- $expected = <<<'EOF'
108
- { '': bar, foo: '#bar', 'foo''bar': { }, bar: [1, foo], foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } } }
109
- EOF;
110
- $this->assertEquals($expected, $this->dumper->dump($this->array, -10), '->dump() takes an inline level argument');
111
- $this->assertEquals($expected, $this->dumper->dump($this->array, 0), '->dump() takes an inline level argument');
112
-
113
- $expected = <<<'EOF'
114
- '': bar
115
- foo: '#bar'
116
- 'foo''bar': { }
117
- bar: [1, foo]
118
- foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } }
119
-
120
- EOF;
121
- $this->assertEquals($expected, $this->dumper->dump($this->array, 1), '->dump() takes an inline level argument');
122
-
123
- $expected = <<<'EOF'
124
- '': bar
125
- foo: '#bar'
126
- 'foo''bar': { }
127
- bar:
128
- - 1
129
- - foo
130
- foobar:
131
- foo: bar
132
- bar: [1, foo]
133
- foobar: { foo: bar, bar: [1, foo] }
134
-
135
- EOF;
136
- $this->assertEquals($expected, $this->dumper->dump($this->array, 2), '->dump() takes an inline level argument');
137
-
138
- $expected = <<<'EOF'
139
- '': bar
140
- foo: '#bar'
141
- 'foo''bar': { }
142
- bar:
143
- - 1
144
- - foo
145
- foobar:
146
- foo: bar
147
- bar:
148
- - 1
149
- - foo
150
- foobar:
151
- foo: bar
152
- bar: [1, foo]
153
-
154
- EOF;
155
- $this->assertEquals($expected, $this->dumper->dump($this->array, 3), '->dump() takes an inline level argument');
156
-
157
- $expected = <<<'EOF'
158
- '': bar
159
- foo: '#bar'
160
- 'foo''bar': { }
161
- bar:
162
- - 1
163
- - foo
164
- foobar:
165
- foo: bar
166
- bar:
167
- - 1
168
- - foo
169
- foobar:
170
- foo: bar
171
- bar:
172
- - 1
173
- - foo
174
-
175
- EOF;
176
- $this->assertEquals($expected, $this->dumper->dump($this->array, 4), '->dump() takes an inline level argument');
177
- $this->assertEquals($expected, $this->dumper->dump($this->array, 10), '->dump() takes an inline level argument');
178
- }
179
-
180
- public function testObjectSupportEnabled()
181
- {
182
- $dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true);
183
-
184
- $this->assertEquals('{ foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}, bar: 1 }', $dump, '->dump() is able to dump objects');
185
- }
186
-
187
- public function testObjectSupportDisabledButNoExceptions()
188
- {
189
- $dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1));
190
-
191
- $this->assertEquals('{ foo: null, bar: 1 }', $dump, '->dump() does not dump objects when disabled');
192
- }
193
-
194
- /**
195
- * @expectedException \Symfony\Component\Yaml\Exception\DumpException
196
- */
197
- public function testObjectSupportDisabledWithExceptions()
198
- {
199
- $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, true, false);
200
- }
201
-
202
- /**
203
- * @dataProvider getEscapeSequences
204
- */
205
- public function testEscapedEscapeSequencesInQuotedScalar($input, $expected)
206
- {
207
- $this->assertEquals($expected, $this->dumper->dump($input));
208
- }
209
-
210
- public function getEscapeSequences()
211
- {
212
- return array(
213
- 'empty string' => array('', "''"),
214
- 'null' => array("\x0", '"\\0"'),
215
- 'bell' => array("\x7", '"\\a"'),
216
- 'backspace' => array("\x8", '"\\b"'),
217
- 'horizontal-tab' => array("\t", '"\\t"'),
218
- 'line-feed' => array("\n", '"\\n"'),
219
- 'vertical-tab' => array("\v", '"\\v"'),
220
- 'form-feed' => array("\xC", '"\\f"'),
221
- 'carriage-return' => array("\r", '"\\r"'),
222
- 'escape' => array("\x1B", '"\\e"'),
223
- 'space' => array(' ', "' '"),
224
- 'double-quote' => array('"', "'\"'"),
225
- 'slash' => array('/', '/'),
226
- 'backslash' => array('\\', '\\'),
227
- 'next-line' => array("\xC2\x85", '"\\N"'),
228
- 'non-breaking-space' => array("\xc2\xa0", '"\\_"'),
229
- 'line-separator' => array("\xE2\x80\xA8", '"\\L"'),
230
- 'paragraph-separator' => array("\xE2\x80\xA9", '"\\P"'),
231
- 'colon' => array(':', "':'"),
232
- );
233
- }
234
-
235
- /**
236
- * @expectedException \InvalidArgumentException
237
- * @expectedExceptionMessage The indentation must be greater than zero
238
- */
239
- public function testZeroIndentationThrowsException()
240
- {
241
- $this->dumper->setIndentation(0);
242
- }
243
-
244
- /**
245
- * @expectedException \InvalidArgumentException
246
- * @expectedExceptionMessage The indentation must be greater than zero
247
- */
248
- public function testNegativeIndentationThrowsException()
249
- {
250
- $this->dumper->setIndentation(-4);
251
- }
252
- }
253
-
254
- class A
255
- {
256
- public $a = 'foo';
257
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml DELETED
@@ -1,31 +0,0 @@
1
- --- %YAML:1.0
2
- test: Simple Alias Example
3
- brief: >
4
- If you need to refer to the same item of data twice,
5
- you can give that item an alias. The alias is a plain
6
- string, starting with an ampersand. The item may then
7
- be referred to by the alias throughout your document
8
- by using an asterisk before the name of the alias.
9
- This is called an anchor.
10
- yaml: |
11
- - &showell Steve
12
- - Clark
13
- - Brian
14
- - Oren
15
- - *showell
16
- php: |
17
- array('Steve', 'Clark', 'Brian', 'Oren', 'Steve')
18
-
19
- ---
20
- test: Alias of a Mapping
21
- brief: >
22
- An alias can be used on any item of data, including
23
- sequences, mappings, and other complex data types.
24
- yaml: |
25
- - &hello
26
- Meat: pork
27
- Starch: potato
28
- - banana
29
- - *hello
30
- php: |
31
- array(array('Meat'=>'pork', 'Starch'=>'potato'), 'banana', array('Meat'=>'pork', 'Starch'=>'potato'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml DELETED
@@ -1,202 +0,0 @@
1
- --- %YAML:1.0
2
- test: Simple Sequence
3
- brief: |
4
- You can specify a list in YAML by placing each
5
- member of the list on a new line with an opening
6
- dash. These lists are called sequences.
7
- yaml: |
8
- - apple
9
- - banana
10
- - carrot
11
- php: |
12
- array('apple', 'banana', 'carrot')
13
- ---
14
- test: Sequence With Item Being Null In The Middle
15
- brief: |
16
- You can specify a list in YAML by placing each
17
- member of the list on a new line with an opening
18
- dash. These lists are called sequences.
19
- yaml: |
20
- - apple
21
- -
22
- - carrot
23
- php: |
24
- array('apple', null, 'carrot')
25
- ---
26
- test: Sequence With Last Item Being Null
27
- brief: |
28
- You can specify a list in YAML by placing each
29
- member of the list on a new line with an opening
30
- dash. These lists are called sequences.
31
- yaml: |
32
- - apple
33
- - banana
34
- -
35
- php: |
36
- array('apple', 'banana', null)
37
- ---
38
- test: Nested Sequences
39
- brief: |
40
- You can include a sequence within another
41
- sequence by giving the sequence an empty
42
- dash, followed by an indented list.
43
- yaml: |
44
- -
45
- - foo
46
- - bar
47
- - baz
48
- php: |
49
- array(array('foo', 'bar', 'baz'))
50
- ---
51
- test: Mixed Sequences
52
- brief: |
53
- Sequences can contain any YAML data,
54
- including strings and other sequences.
55
- yaml: |
56
- - apple
57
- -
58
- - foo
59
- - bar
60
- - x123
61
- - banana
62
- - carrot
63
- php: |
64
- array('apple', array('foo', 'bar', 'x123'), 'banana', 'carrot')
65
- ---
66
- test: Deeply Nested Sequences
67
- brief: |
68
- Sequences can be nested even deeper, with each
69
- level of indentation representing a level of
70
- depth.
71
- yaml: |
72
- -
73
- -
74
- - uno
75
- - dos
76
- php: |
77
- array(array(array('uno', 'dos')))
78
- ---
79
- test: Simple Mapping
80
- brief: |
81
- You can add a keyed list (also known as a dictionary or
82
- hash) to your document by placing each member of the
83
- list on a new line, with a colon separating the key
84
- from its value. In YAML, this type of list is called
85
- a mapping.
86
- yaml: |
87
- foo: whatever
88
- bar: stuff
89
- php: |
90
- array('foo' => 'whatever', 'bar' => 'stuff')
91
- ---
92
- test: Sequence in a Mapping
93
- brief: |
94
- A value in a mapping can be a sequence.
95
- yaml: |
96
- foo: whatever
97
- bar:
98
- - uno
99
- - dos
100
- php: |
101
- array('foo' => 'whatever', 'bar' => array('uno', 'dos'))
102
- ---
103
- test: Nested Mappings
104
- brief: |
105
- A value in a mapping can be another mapping.
106
- yaml: |
107
- foo: whatever
108
- bar:
109
- fruit: apple
110
- name: steve
111
- sport: baseball
112
- php: |
113
- array(
114
- 'foo' => 'whatever',
115
- 'bar' => array(
116
- 'fruit' => 'apple',
117
- 'name' => 'steve',
118
- 'sport' => 'baseball'
119
- )
120
- )
121
- ---
122
- test: Mixed Mapping
123
- brief: |
124
- A mapping can contain any assortment
125
- of mappings and sequences as values.
126
- yaml: |
127
- foo: whatever
128
- bar:
129
- -
130
- fruit: apple
131
- name: steve
132
- sport: baseball
133
- - more
134
- -
135
- python: rocks
136
- perl: papers
137
- ruby: scissorses
138
- php: |
139
- array(
140
- 'foo' => 'whatever',
141
- 'bar' => array(
142
- array(
143
- 'fruit' => 'apple',
144
- 'name' => 'steve',
145
- 'sport' => 'baseball'
146
- ),
147
- 'more',
148
- array(
149
- 'python' => 'rocks',
150
- 'perl' => 'papers',
151
- 'ruby' => 'scissorses'
152
- )
153
- )
154
- )
155
- ---
156
- test: Mapping-in-Sequence Shortcut
157
- todo: true
158
- brief: |
159
- If you are adding a mapping to a sequence, you
160
- can place the mapping on the same line as the
161
- dash as a shortcut.
162
- yaml: |
163
- - work on YAML.py:
164
- - work on Store
165
- php: |
166
- array(array('work on YAML.py' => array('work on Store')))
167
- ---
168
- test: Sequence-in-Mapping Shortcut
169
- todo: true
170
- brief: |
171
- The dash in a sequence counts as indentation, so
172
- you can add a sequence inside of a mapping without
173
- needing spaces as indentation.
174
- yaml: |
175
- allow:
176
- - 'localhost'
177
- - '%.sourceforge.net'
178
- - '%.freepan.org'
179
- php: |
180
- array('allow' => array('localhost', '%.sourceforge.net', '%.freepan.org'))
181
- ---
182
- todo: true
183
- test: Merge key
184
- brief: |
185
- A merge key ('<<') can be used in a mapping to insert other mappings. If
186
- the value associated with the merge key is a mapping, each of its key/value
187
- pairs is inserted into the current mapping.
188
- yaml: |
189
- mapping:
190
- name: Joe
191
- job: Accountant
192
- <<:
193
- age: 38
194
- php: |
195
- array(
196
- 'mapping' =>
197
- array(
198
- 'name' => 'Joe',
199
- 'job' => 'Accountant',
200
- 'age' => 38
201
- )
202
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml DELETED
@@ -1,51 +0,0 @@
1
- ---
2
- test: One Element Mapping
3
- brief: |
4
- A mapping with one key/value pair
5
- yaml: |
6
- foo: bar
7
- php: |
8
- array('foo' => 'bar')
9
- ---
10
- test: Multi Element Mapping
11
- brief: |
12
- More than one key/value pair
13
- yaml: |
14
- red: baron
15
- white: walls
16
- blue: berries
17
- php: |
18
- array(
19
- 'red' => 'baron',
20
- 'white' => 'walls',
21
- 'blue' => 'berries',
22
- )
23
- ---
24
- test: Values aligned
25
- brief: |
26
- Often times human editors of documents will align the values even
27
- though YAML emitters generally don't.
28
- yaml: |
29
- red: baron
30
- white: walls
31
- blue: berries
32
- php: |
33
- array(
34
- 'red' => 'baron',
35
- 'white' => 'walls',
36
- 'blue' => 'berries',
37
- )
38
- ---
39
- test: Colons aligned
40
- brief: |
41
- Spaces can come before the ': ' key/value separator.
42
- yaml: |
43
- red : baron
44
- white : walls
45
- blue : berries
46
- php: |
47
- array(
48
- 'red' => 'baron',
49
- 'white' => 'walls',
50
- 'blue' => 'berries',
51
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml DELETED
@@ -1,85 +0,0 @@
1
- --- %YAML:1.0
2
- test: Trailing Document Separator
3
- todo: true
4
- brief: >
5
- You can separate YAML documents
6
- with a string of three dashes.
7
- yaml: |
8
- - foo: 1
9
- bar: 2
10
- ---
11
- more: stuff
12
- python: |
13
- [
14
- [ { 'foo': 1, 'bar': 2 } ],
15
- { 'more': 'stuff' }
16
- ]
17
- ruby: |
18
- [ { 'foo' => 1, 'bar' => 2 } ]
19
-
20
- ---
21
- test: Leading Document Separator
22
- todo: true
23
- brief: >
24
- You can explicitly give an opening
25
- document separator to your YAML stream.
26
- yaml: |
27
- ---
28
- - foo: 1
29
- bar: 2
30
- ---
31
- more: stuff
32
- python: |
33
- [
34
- [ {'foo': 1, 'bar': 2}],
35
- {'more': 'stuff'}
36
- ]
37
- ruby: |
38
- [ { 'foo' => 1, 'bar' => 2 } ]
39
-
40
- ---
41
- test: YAML Header
42
- todo: true
43
- brief: >
44
- The opening separator can contain directives
45
- to the YAML parser, such as the version
46
- number.
47
- yaml: |
48
- --- %YAML:1.0
49
- foo: 1
50
- bar: 2
51
- php: |
52
- array('foo' => 1, 'bar' => 2)
53
- documents: 1
54
-
55
- ---
56
- test: Red Herring Document Separator
57
- brief: >
58
- Separators included in blocks or strings
59
- are treated as blocks or strings, as the
60
- document separator should have no indentation
61
- preceding it.
62
- yaml: |
63
- foo: |
64
- ---
65
- php: |
66
- array('foo' => "---\n")
67
-
68
- ---
69
- test: Multiple Document Separators in Block
70
- brief: >
71
- This technique allows you to embed other YAML
72
- documents within literal blocks.
73
- yaml: |
74
- foo: |
75
- ---
76
- foo: bar
77
- ---
78
- yo: baz
79
- bar: |
80
- fooness
81
- php: |
82
- array(
83
- 'foo' => "---\nfoo: bar\n---\nyo: baz\n",
84
- 'bar' => "fooness\n"
85
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml DELETED
@@ -1,25 +0,0 @@
1
- ---
2
- test: Missing value for hash item
3
- todo: true
4
- brief: |
5
- Third item in this hash doesn't have a value
6
- yaml: |
7
- okay: value
8
- also okay: ~
9
- causes error because no value specified
10
- last key: value okay here too
11
- python-error: causes error because no value specified
12
-
13
- ---
14
- test: Not indenting enough
15
- brief: |
16
- There was a bug in PyYaml where it was off by one
17
- in the indentation check. It was allowing the YAML
18
- below.
19
- # This is actually valid YAML now. Someone should tell showell.
20
- yaml: |
21
- foo:
22
- firstline: 1
23
- secondline: 2
24
- php: |
25
- array('foo' => null, 'firstline' => 1, 'secondline' => 2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml DELETED
@@ -1,60 +0,0 @@
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
- array('seq' => array('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
- array('hash' => array('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
- array(
42
- 'languages' => array('Ruby', 'Perl', 'Python'),
43
- 'websites' => array(
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
- array('attendances' => array(45123, 70000, 17222))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml DELETED
@@ -1,176 +0,0 @@
1
- --- %YAML:1.0
2
- test: Single ending newline
3
- brief: >
4
- A pipe character, followed by an indented
5
- block of text is treated as a literal
6
- block, in which newlines are preserved
7
- throughout the block, including the final
8
- newline.
9
- yaml: |
10
- ---
11
- this: |
12
- Foo
13
- Bar
14
- php: |
15
- array('this' => "Foo\nBar\n")
16
- ---
17
- test: The '+' indicator
18
- brief: >
19
- The '+' indicator says to keep newlines at the end of text
20
- blocks.
21
- yaml: |
22
- normal: |
23
- extra new lines not kept
24
-
25
- preserving: |+
26
- extra new lines are kept
27
-
28
-
29
- dummy: value
30
- php: |
31
- array(
32
- 'normal' => "extra new lines not kept\n",
33
- 'preserving' => "extra new lines are kept\n\n\n",
34
- 'dummy' => 'value'
35
- )
36
- ---
37
- test: Three trailing newlines in literals
38
- brief: >
39
- To give you more control over how space
40
- is preserved in text blocks, YAML has
41
- the keep '+' and chomp '-' indicators.
42
- The keep indicator will preserve all
43
- ending newlines, while the chomp indicator
44
- will strip all ending newlines.
45
- yaml: |
46
- clipped: |
47
- This has one newline.
48
-
49
-
50
-
51
- same as "clipped" above: "This has one newline.\n"
52
-
53
- stripped: |-
54
- This has no newline.
55
-
56
-
57
-
58
- same as "stripped" above: "This has no newline."
59
-
60
- kept: |+
61
- This has four newlines.
62
-
63
-
64
-
65
- same as "kept" above: "This has four newlines.\n\n\n\n"
66
- php: |
67
- array(
68
- 'clipped' => "This has one newline.\n",
69
- 'same as "clipped" above' => "This has one newline.\n",
70
- 'stripped' => 'This has no newline.',
71
- 'same as "stripped" above' => 'This has no newline.',
72
- 'kept' => "This has four newlines.\n\n\n\n",
73
- 'same as "kept" above' => "This has four newlines.\n\n\n\n"
74
- )
75
- ---
76
- test: Extra trailing newlines with spaces
77
- todo: true
78
- brief: >
79
- Normally, only a single newline is kept
80
- from the end of a literal block, unless the
81
- keep '+' character is used in combination
82
- with the pipe. The following example
83
- will preserve all ending whitespace
84
- since the last line of both literal blocks
85
- contains spaces which extend past the indentation
86
- level.
87
- yaml: |
88
- ---
89
- this: |
90
- Foo
91
-
92
-
93
- kept: |+
94
- Foo
95
-
96
-
97
- php: |
98
- array('this' => "Foo\n\n \n",
99
- 'kept' => "Foo\n\n \n" )
100
-
101
- ---
102
- test: Folded Block in a Sequence
103
- brief: >
104
- A greater-then character, followed by an indented
105
- block of text is treated as a folded block, in
106
- which lines of text separated by a single newline
107
- are concatenated as a single line.
108
- yaml: |
109
- ---
110
- - apple
111
- - banana
112
- - >
113
- can't you see
114
- the beauty of yaml?
115
- hmm
116
- - dog
117
- php: |
118
- array(
119
- 'apple',
120
- 'banana',
121
- "can't you see the beauty of yaml? hmm\n",
122
- 'dog'
123
- )
124
- ---
125
- test: Folded Block as a Mapping Value
126
- brief: >
127
- Both literal and folded blocks can be
128
- used in collections, as values in a
129
- sequence or a mapping.
130
- yaml: |
131
- ---
132
- quote: >
133
- Mark McGwire's
134
- year was crippled
135
- by a knee injury.
136
- source: espn
137
- php: |
138
- array(
139
- 'quote' => "Mark McGwire's year was crippled by a knee injury.\n",
140
- 'source' => 'espn'
141
- )
142
- ---
143
- test: Three trailing newlines in folded blocks
144
- brief: >
145
- The keep and chomp indicators can also
146
- be applied to folded blocks.
147
- yaml: |
148
- clipped: >
149
- This has one newline.
150
-
151
-
152
-
153
- same as "clipped" above: "This has one newline.\n"
154
-
155
- stripped: >-
156
- This has no newline.
157
-
158
-
159
-
160
- same as "stripped" above: "This has no newline."
161
-
162
- kept: >+
163
- This has four newlines.
164
-
165
-
166
-
167
- same as "kept" above: "This has four newlines.\n\n\n\n"
168
- php: |
169
- array(
170
- 'clipped' => "This has one newline.\n",
171
- 'same as "clipped" above' => "This has one newline.\n",
172
- 'stripped' => 'This has no newline.',
173
- 'same as "stripped" above' => 'This has no newline.',
174
- 'kept' => "This has four newlines.\n\n\n\n",
175
- 'same as "kept" above' => "This has four newlines.\n\n\n\n"
176
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml DELETED
@@ -1,45 +0,0 @@
1
- --- %YAML:1.0
2
- test: Empty Sequence
3
- brief: >
4
- You can represent the empty sequence
5
- with an empty inline sequence.
6
- yaml: |
7
- empty: []
8
- php: |
9
- array('empty' => array())
10
- ---
11
- test: Empty Mapping
12
- brief: >
13
- You can represent the empty mapping
14
- with an empty inline mapping.
15
- yaml: |
16
- empty: {}
17
- php: |
18
- array('empty' => array())
19
- ---
20
- test: Empty Sequence as Entire Document
21
- yaml: |
22
- []
23
- php: |
24
- array()
25
- ---
26
- test: Empty Mapping as Entire Document
27
- yaml: |
28
- {}
29
- php: |
30
- array()
31
- ---
32
- test: Null as Document
33
- yaml: |
34
- ~
35
- php: |
36
- null
37
- ---
38
- test: Empty String
39
- brief: >
40
- You can represent an empty string
41
- with a pair of quotes.
42
- yaml: |
43
- ''
44
- php: |
45
- ''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml DELETED
@@ -1,1697 +0,0 @@
1
- --- %YAML:1.0
2
- test: Sequence of scalars
3
- spec: 2.1
4
- yaml: |
5
- - Mark McGwire
6
- - Sammy Sosa
7
- - Ken Griffey
8
- php: |
9
- array('Mark McGwire', 'Sammy Sosa', 'Ken Griffey')
10
- ---
11
- test: Mapping of scalars to scalars
12
- spec: 2.2
13
- yaml: |
14
- hr: 65
15
- avg: 0.278
16
- rbi: 147
17
- php: |
18
- array('hr' => 65, 'avg' => 0.278, 'rbi' => 147)
19
- ---
20
- test: Mapping of scalars to sequences
21
- spec: 2.3
22
- yaml: |
23
- american:
24
- - Boston Red Sox
25
- - Detroit Tigers
26
- - New York Yankees
27
- national:
28
- - New York Mets
29
- - Chicago Cubs
30
- - Atlanta Braves
31
- php: |
32
- array('american' =>
33
- array( 'Boston Red Sox', 'Detroit Tigers',
34
- 'New York Yankees' ),
35
- 'national' =>
36
- array( 'New York Mets', 'Chicago Cubs',
37
- 'Atlanta Braves' )
38
- )
39
- ---
40
- test: Sequence of mappings
41
- spec: 2.4
42
- yaml: |
43
- -
44
- name: Mark McGwire
45
- hr: 65
46
- avg: 0.278
47
- -
48
- name: Sammy Sosa
49
- hr: 63
50
- avg: 0.288
51
- php: |
52
- array(
53
- array('name' => 'Mark McGwire', 'hr' => 65, 'avg' => 0.278),
54
- array('name' => 'Sammy Sosa', 'hr' => 63, 'avg' => 0.288)
55
- )
56
- ---
57
- test: Legacy A5
58
- todo: true
59
- spec: legacy_A5
60
- yaml: |
61
- ?
62
- - New York Yankees
63
- - Atlanta Braves
64
- :
65
- - 2001-07-02
66
- - 2001-08-12
67
- - 2001-08-14
68
- ?
69
- - Detroit Tigers
70
- - Chicago Cubs
71
- :
72
- - 2001-07-23
73
- perl-busted: >
74
- YAML.pm will be able to emulate this behavior soon. In this regard
75
- it may be somewhat more correct than Python's native behaviour which
76
- can only use tuples as mapping keys. PyYAML will also need to figure
77
- out some clever way to roundtrip structured keys.
78
- python: |
79
- [
80
- {
81
- ('New York Yankees', 'Atlanta Braves'):
82
- [yaml.timestamp('2001-07-02'),
83
- yaml.timestamp('2001-08-12'),
84
- yaml.timestamp('2001-08-14')],
85
- ('Detroit Tigers', 'Chicago Cubs'):
86
- [yaml.timestamp('2001-07-23')]
87
- }
88
- ]
89
- ruby: |
90
- {
91
- [ 'New York Yankees', 'Atlanta Braves' ] =>
92
- [ Date.new( 2001, 7, 2 ), Date.new( 2001, 8, 12 ), Date.new( 2001, 8, 14 ) ],
93
- [ 'Detroit Tigers', 'Chicago Cubs' ] =>
94
- [ Date.new( 2001, 7, 23 ) ]
95
- }
96
- syck: |
97
- struct test_node seq1[] = {
98
- { T_STR, 0, "New York Yankees" },
99
- { T_STR, 0, "Atlanta Braves" },
100
- end_node
101
- };
102
- struct test_node seq2[] = {
103
- { T_STR, 0, "2001-07-02" },
104
- { T_STR, 0, "2001-08-12" },
105
- { T_STR, 0, "2001-08-14" },
106
- end_node
107
- };
108
- struct test_node seq3[] = {
109
- { T_STR, 0, "Detroit Tigers" },
110
- { T_STR, 0, "Chicago Cubs" },
111
- end_node
112
- };
113
- struct test_node seq4[] = {
114
- { T_STR, 0, "2001-07-23" },
115
- end_node
116
- };
117
- struct test_node map[] = {
118
- { T_SEQ, 0, 0, seq1 },
119
- { T_SEQ, 0, 0, seq2 },
120
- { T_SEQ, 0, 0, seq3 },
121
- { T_SEQ, 0, 0, seq4 },
122
- end_node
123
- };
124
- struct test_node stream[] = {
125
- { T_MAP, 0, 0, map },
126
- end_node
127
- };
128
-
129
- ---
130
- test: Sequence of sequences
131
- spec: 2.5
132
- yaml: |
133
- - [ name , hr , avg ]
134
- - [ Mark McGwire , 65 , 0.278 ]
135
- - [ Sammy Sosa , 63 , 0.288 ]
136
- php: |
137
- array(
138
- array( 'name', 'hr', 'avg' ),
139
- array( 'Mark McGwire', 65, 0.278 ),
140
- array( 'Sammy Sosa', 63, 0.288 )
141
- )
142
- ---
143
- test: Mapping of mappings
144
- todo: true
145
- spec: 2.6
146
- yaml: |
147
- Mark McGwire: {hr: 65, avg: 0.278}
148
- Sammy Sosa: {
149
- hr: 63,
150
- avg: 0.288
151
- }
152
- php: |
153
- array(
154
- 'Mark McGwire' =>
155
- array( 'hr' => 65, 'avg' => 0.278 ),
156
- 'Sammy Sosa' =>
157
- array( 'hr' => 63, 'avg' => 0.288 )
158
- )
159
- ---
160
- test: Two documents in a stream each with a leading comment
161
- todo: true
162
- spec: 2.7
163
- yaml: |
164
- # Ranking of 1998 home runs
165
- ---
166
- - Mark McGwire
167
- - Sammy Sosa
168
- - Ken Griffey
169
-
170
- # Team ranking
171
- ---
172
- - Chicago Cubs
173
- - St Louis Cardinals
174
- ruby: |
175
- y = YAML::Stream.new
176
- y.add( [ 'Mark McGwire', 'Sammy Sosa', 'Ken Griffey' ] )
177
- y.add( [ 'Chicago Cubs', 'St Louis Cardinals' ] )
178
- documents: 2
179
-
180
- ---
181
- test: Play by play feed from a game
182
- todo: true
183
- spec: 2.8
184
- yaml: |
185
- ---
186
- time: 20:03:20
187
- player: Sammy Sosa
188
- action: strike (miss)
189
- ...
190
- ---
191
- time: 20:03:47
192
- player: Sammy Sosa
193
- action: grand slam
194
- ...
195
- perl: |
196
- [ 'Mark McGwire', 'Sammy Sosa', 'Ken Griffey' ]
197
- documents: 2
198
-
199
- ---
200
- test: Single document with two comments
201
- spec: 2.9
202
- yaml: |
203
- hr: # 1998 hr ranking
204
- - Mark McGwire
205
- - Sammy Sosa
206
- rbi:
207
- # 1998 rbi ranking
208
- - Sammy Sosa
209
- - Ken Griffey
210
- php: |
211
- array(
212
- 'hr' => array( 'Mark McGwire', 'Sammy Sosa' ),
213
- 'rbi' => array( 'Sammy Sosa', 'Ken Griffey' )
214
- )
215
- ---
216
- test: Node for Sammy Sosa appears twice in this document
217
- spec: 2.10
218
- yaml: |
219
- ---
220
- hr:
221
- - Mark McGwire
222
- # Following node labeled SS
223
- - &SS Sammy Sosa
224
- rbi:
225
- - *SS # Subsequent occurrence
226
- - Ken Griffey
227
- php: |
228
- array(
229
- 'hr' =>
230
- array('Mark McGwire', 'Sammy Sosa'),
231
- 'rbi' =>
232
- array('Sammy Sosa', 'Ken Griffey')
233
- )
234
- ---
235
- test: Mapping between sequences
236
- todo: true
237
- spec: 2.11
238
- yaml: |
239
- ? # PLAY SCHEDULE
240
- - Detroit Tigers
241
- - Chicago Cubs
242
- :
243
- - 2001-07-23
244
-
245
- ? [ New York Yankees,
246
- Atlanta Braves ]
247
- : [ 2001-07-02, 2001-08-12,
248
- 2001-08-14 ]
249
- ruby: |
250
- {
251
- [ 'Detroit Tigers', 'Chicago Cubs' ] => [ Date.new( 2001, 7, 23 ) ],
252
- [ 'New York Yankees', 'Atlanta Braves' ] => [ Date.new( 2001, 7, 2 ), Date.new( 2001, 8, 12 ), Date.new( 2001, 8, 14 ) ]
253
- }
254
- syck: |
255
- struct test_node seq1[] = {
256
- { T_STR, 0, "New York Yankees" },
257
- { T_STR, 0, "Atlanta Braves" },
258
- end_node
259
- };
260
- struct test_node seq2[] = {
261
- { T_STR, 0, "2001-07-02" },
262
- { T_STR, 0, "2001-08-12" },
263
- { T_STR, 0, "2001-08-14" },
264
- end_node
265
- };
266
- struct test_node seq3[] = {
267
- { T_STR, 0, "Detroit Tigers" },
268
- { T_STR, 0, "Chicago Cubs" },
269
- end_node
270
- };
271
- struct test_node seq4[] = {
272
- { T_STR, 0, "2001-07-23" },
273
- end_node
274
- };
275
- struct test_node map[] = {
276
- { T_SEQ, 0, 0, seq3 },
277
- { T_SEQ, 0, 0, seq4 },
278
- { T_SEQ, 0, 0, seq1 },
279
- { T_SEQ, 0, 0, seq2 },
280
- end_node
281
- };
282
- struct test_node stream[] = {
283
- { T_MAP, 0, 0, map },
284
- end_node
285
- };
286
-
287
- ---
288
- test: Sequence key shortcut
289
- spec: 2.12
290
- yaml: |
291
- ---
292
- # products purchased
293
- - item : Super Hoop
294
- quantity: 1
295
- - item : Basketball
296
- quantity: 4
297
- - item : Big Shoes
298
- quantity: 1
299
- php: |
300
- array (
301
- array (
302
- 'item' => 'Super Hoop',
303
- 'quantity' => 1,
304
- ),
305
- array (
306
- 'item' => 'Basketball',
307
- 'quantity' => 4,
308
- ),
309
- array (
310
- 'item' => 'Big Shoes',
311
- 'quantity' => 1,
312
- )
313
- )
314
- perl: |
315
- [
316
- { item => 'Super Hoop', quantity => 1 },
317
- { item => 'Basketball', quantity => 4 },
318
- { item => 'Big Shoes', quantity => 1 }
319
- ]
320
-
321
- ruby: |
322
- [
323
- { 'item' => 'Super Hoop', 'quantity' => 1 },
324
- { 'item' => 'Basketball', 'quantity' => 4 },
325
- { 'item' => 'Big Shoes', 'quantity' => 1 }
326
- ]
327
- python: |
328
- [
329
- { 'item': 'Super Hoop', 'quantity': 1 },
330
- { 'item': 'Basketball', 'quantity': 4 },
331
- { 'item': 'Big Shoes', 'quantity': 1 }
332
- ]
333
- syck: |
334
- struct test_node map1[] = {
335
- { T_STR, 0, "item" },
336
- { T_STR, 0, "Super Hoop" },
337
- { T_STR, 0, "quantity" },
338
- { T_STR, 0, "1" },
339
- end_node
340
- };
341
- struct test_node map2[] = {
342
- { T_STR, 0, "item" },
343
- { T_STR, 0, "Basketball" },
344
- { T_STR, 0, "quantity" },
345
- { T_STR, 0, "4" },
346
- end_node
347
- };
348
- struct test_node map3[] = {
349
- { T_STR, 0, "item" },
350
- { T_STR, 0, "Big Shoes" },
351
- { T_STR, 0, "quantity" },
352
- { T_STR, 0, "1" },
353
- end_node
354
- };
355
- struct test_node seq[] = {
356
- { T_MAP, 0, 0, map1 },
357
- { T_MAP, 0, 0, map2 },
358
- { T_MAP, 0, 0, map3 },
359
- end_node
360
- };
361
- struct test_node stream[] = {
362
- { T_SEQ, 0, 0, seq },
363
- end_node
364
- };
365
-
366
-
367
- ---
368
- test: Literal perserves newlines
369
- todo: true
370
- spec: 2.13
371
- yaml: |
372
- # ASCII Art
373
- --- |
374
- \//||\/||
375
- // || ||_
376
- perl: |
377
- "\\//||\\/||\n// || ||_\n"
378
- ruby: |
379
- "\\//||\\/||\n// || ||_\n"
380
- python: |
381
- [
382
- flushLeft(
383
- """
384
- \//||\/||
385
- // || ||_
386
- """
387
- )
388
- ]
389
- syck: |
390
- struct test_node stream[] = {
391
- { T_STR, 0, "\\//||\\/||\n// || ||_\n" },
392
- end_node
393
- };
394
-
395
- ---
396
- test: Folded treats newlines as a space
397
- todo: true
398
- spec: 2.14
399
- yaml: |
400
- ---
401
- Mark McGwire's
402
- year was crippled
403
- by a knee injury.
404
- perl: |
405
- "Mark McGwire's year was crippled by a knee injury."
406
- ruby: |
407
- "Mark McGwire's year was crippled by a knee injury."
408
- python: |
409
- [ "Mark McGwire's year was crippled by a knee injury." ]
410
- syck: |
411
- struct test_node stream[] = {
412
- { T_STR, 0, "Mark McGwire's year was crippled by a knee injury." },
413
- end_node
414
- };
415
-
416
- ---
417
- test: Newlines preserved for indented and blank lines
418
- todo: true
419
- spec: 2.15
420
- yaml: |
421
- --- >
422
- Sammy Sosa completed another
423
- fine season with great stats.
424
-
425
- 63 Home Runs
426
- 0.288 Batting Average
427
-
428
- What a year!
429
- perl: |
430
- "Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n"
431
- ruby: |
432
- "Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n"
433
- python: |
434
- [
435
- flushLeft(
436
- """
437
- Sammy Sosa completed another fine season with great stats.
438
-
439
- 63 Home Runs
440
- 0.288 Batting Average
441
-
442
- What a year!
443
- """
444
- )
445
- ]
446
- syck: |
447
- struct test_node stream[] = {
448
- { T_STR, 0, "Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n" },
449
- end_node
450
- };
451
-
452
-
453
- ---
454
- test: Indentation determines scope
455
- spec: 2.16
456
- yaml: |
457
- name: Mark McGwire
458
- accomplishment: >
459
- Mark set a major league
460
- home run record in 1998.
461
- stats: |
462
- 65 Home Runs
463
- 0.278 Batting Average
464
- php: |
465
- array(
466
- 'name' => 'Mark McGwire',
467
- 'accomplishment' => "Mark set a major league home run record in 1998.\n",
468
- 'stats' => "65 Home Runs\n0.278 Batting Average\n"
469
- )
470
- ---
471
- test: Quoted scalars
472
- todo: true
473
- spec: 2.17
474
- yaml: |
475
- unicode: "Sosa did fine.\u263A"
476
- control: "\b1998\t1999\t2000\n"
477
- hexesc: "\x0D\x0A is \r\n"
478
-
479
- single: '"Howdy!" he cried.'
480
- quoted: ' # not a ''comment''.'
481
- tie-fighter: '|\-*-/|'
482
- ruby: |
483
- {
484
- "tie-fighter" => "|\\-*-/|",
485
- "control"=>"\0101998\t1999\t2000\n",
486
- "unicode"=>"Sosa did fine." + ["263A".hex ].pack('U*'),
487
- "quoted"=>" # not a 'comment'.",
488
- "single"=>"\"Howdy!\" he cried.",
489
- "hexesc"=>"\r\n is \r\n"
490
- }
491
- ---
492
- test: Multiline flow scalars
493
- todo: true
494
- spec: 2.18
495
- yaml: |
496
- plain:
497
- This unquoted scalar
498
- spans many lines.
499
-
500
- quoted: "So does this
501
- quoted scalar.\n"
502
- ruby: |
503
- {
504
- 'plain' => 'This unquoted scalar spans many lines.',
505
- 'quoted' => "So does this quoted scalar.\n"
506
- }
507
- ---
508
- test: Integers
509
- spec: 2.19
510
- yaml: |
511
- canonical: 12345
512
- decimal: +12,345
513
- octal: 014
514
- hexadecimal: 0xC
515
- php: |
516
- array(
517
- 'canonical' => 12345,
518
- 'decimal' => 12345.0,
519
- 'octal' => 014,
520
- 'hexadecimal' => 0xC
521
- )
522
- ---
523
- # FIX: spec shows parens around -inf and NaN
524
- test: Floating point
525
- spec: 2.20
526
- yaml: |
527
- canonical: 1.23015e+3
528
- exponential: 12.3015e+02
529
- fixed: 1,230.15
530
- negative infinity: -.inf
531
- not a number: .NaN
532
- float as whole number: !!float 1
533
- php: |
534
- array(
535
- 'canonical' => 1230.15,
536
- 'exponential' => 1230.15,
537
- 'fixed' => 1230.15,
538
- 'negative infinity' => log(0),
539
- 'not a number' => -log(0),
540
- 'float as whole number' => (float) 1
541
- )
542
- ---
543
- test: Miscellaneous
544
- spec: 2.21
545
- yaml: |
546
- null: ~
547
- true: true
548
- false: false
549
- string: '12345'
550
- php: |
551
- array(
552
- '' => null,
553
- 1 => true,
554
- 0 => false,
555
- 'string' => '12345'
556
- )
557
- ---
558
- test: Timestamps
559
- todo: true
560
- spec: 2.22
561
- yaml: |
562
- canonical: 2001-12-15T02:59:43.1Z
563
- iso8601: 2001-12-14t21:59:43.10-05:00
564
- spaced: 2001-12-14 21:59:43.10 -05:00
565
- date: 2002-12-14 # Time is noon UTC
566
- php: |
567
- array(
568
- 'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),
569
- 'iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
570
- 'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
571
- 'date' => Date.new( 2002, 12, 14 )
572
- )
573
- ---
574
- test: legacy Timestamps test
575
- todo: true
576
- spec: legacy D4
577
- yaml: |
578
- canonical: 2001-12-15T02:59:43.00Z
579
- iso8601: 2001-02-28t21:59:43.00-05:00
580
- spaced: 2001-12-14 21:59:43.00 -05:00
581
- date: 2002-12-14
582
- php: |
583
- array(
584
- 'canonical' => Time::utc( 2001, 12, 15, 2, 59, 43, 0 ),
585
- 'iso8601' => YAML::mktime( 2001, 2, 28, 21, 59, 43, 0, "-05:00" ),
586
- 'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0, "-05:00" ),
587
- 'date' => Date.new( 2002, 12, 14 )
588
- )
589
- ---
590
- test: Various explicit families
591
- todo: true
592
- spec: 2.23
593
- yaml: |
594
- not-date: !str 2002-04-28
595
- picture: !binary |
596
- R0lGODlhDAAMAIQAAP//9/X
597
- 17unp5WZmZgAAAOfn515eXv
598
- Pz7Y6OjuDg4J+fn5OTk6enp
599
- 56enmleECcgggoBADs=
600
-
601
- application specific tag: !!something |
602
- The semantics of the tag
603
- above may be different for
604
- different documents.
605
-
606
- ruby-setup: |
607
- YAML.add_private_type( "something" ) do |type, val|
608
- "SOMETHING: #{val}"
609
- end
610
- ruby: |
611
- {
612
- 'not-date' => '2002-04-28',
613
- 'picture' => "GIF89a\f\000\f\000\204\000\000\377\377\367\365\365\356\351\351\345fff\000\000\000\347\347\347^^^\363\363\355\216\216\216\340\340\340\237\237\237\223\223\223\247\247\247\236\236\236i^\020' \202\n\001\000;",
614
- 'application specific tag' => "SOMETHING: The semantics of the tag\nabove may be different for\ndifferent documents.\n"
615
- }
616
- ---
617
- test: Application specific family
618
- todo: true
619
- spec: 2.24
620
- yaml: |
621
- # Establish a tag prefix
622
- --- !clarkevans.com,2002/graph/^shape
623
- # Use the prefix: shorthand for
624
- # !clarkevans.com,2002/graph/circle
625
- - !^circle
626
- center: &ORIGIN {x: 73, 'y': 129}
627
- radius: 7
628
- - !^line # !clarkevans.com,2002/graph/line
629
- start: *ORIGIN
630
- finish: { x: 89, 'y': 102 }
631
- - !^label
632
- start: *ORIGIN
633
- color: 0xFFEEBB
634
- value: Pretty vector drawing.
635
- ruby-setup: |
636
- YAML.add_domain_type( "clarkevans.com,2002", 'graph/shape' ) { |type, val|
637
- if Array === val
638
- val << "Shape Container"
639
- val
640
- else
641
- raise YAML::Error, "Invalid graph of class #{ val.class }: " + val.inspect
642
- end
643
- }
644
- one_shape_proc = Proc.new { |type, val|
645
- scheme, domain, type = type.split( /:/, 3 )
646
- if val.is_a? ::Hash
647
- val['TYPE'] = "Shape: #{type}"
648
- val
649
- else
650
- raise YAML::Error, "Invalid graph of class #{ val.class }: " + val.inspect
651
- end
652
- }
653
- YAML.add_domain_type( "clarkevans.com,2002", 'graph/circle', &one_shape_proc )
654
- YAML.add_domain_type( "clarkevans.com,2002", 'graph/line', &one_shape_proc )
655
- YAML.add_domain_type( "clarkevans.com,2002", 'graph/label', &one_shape_proc )
656
- ruby: |
657
- [
658
- {
659
- "radius" => 7,
660
- "center"=>
661
- {
662
- "x" => 73,
663
- "y" => 129
664
- },
665
- "TYPE" => "Shape: graph/circle"
666
- }, {
667
- "finish" =>
668
- {
669
- "x" => 89,
670
- "y" => 102
671
- },
672
- "TYPE" => "Shape: graph/line",
673
- "start" =>
674
- {
675
- "x" => 73,
676
- "y" => 129
677
- }
678
- }, {
679
- "TYPE" => "Shape: graph/label",
680
- "value" => "Pretty vector drawing.",
681
- "start" =>
682
- {
683
- "x" => 73,
684
- "y" => 129
685
- },
686
- "color" => 16772795
687
- },
688
- "Shape Container"
689
- ]
690
- # ---
691
- # test: Unordered set
692
- # spec: 2.25
693
- # yaml: |
694
- # # sets are represented as a
695
- # # mapping where each key is
696
- # # associated with the empty string
697
- # --- !set
698
- # ? Mark McGwire
699
- # ? Sammy Sosa
700
- # ? Ken Griff
701
- ---
702
- test: Ordered mappings
703
- todo: true
704
- spec: 2.26
705
- yaml: |
706
- # ordered maps are represented as
707
- # a sequence of mappings, with
708
- # each mapping having one key
709
- --- !omap
710
- - Mark McGwire: 65
711
- - Sammy Sosa: 63
712
- - Ken Griffy: 58
713
- ruby: |
714
- YAML::Omap[
715
- 'Mark McGwire', 65,
716
- 'Sammy Sosa', 63,
717
- 'Ken Griffy', 58
718
- ]
719
- ---
720
- test: Invoice
721
- dump_skip: true
722
- spec: 2.27
723
- yaml: |
724
- --- !clarkevans.com,2002/^invoice
725
- invoice: 34843
726
- date : 2001-01-23
727
- bill-to: &id001
728
- given : Chris
729
- family : Dumars
730
- address:
731
- lines: |
732
- 458 Walkman Dr.
733
- Suite #292
734
- city : Royal Oak
735
- state : MI
736
- postal : 48046
737
- ship-to: *id001
738
- product:
739
- -
740
- sku : BL394D
741
- quantity : 4
742
- description : Basketball
743
- price : 450.00
744
- -
745
- sku : BL4438H
746
- quantity : 1
747
- description : Super Hoop
748
- price : 2392.00
749
- tax : 251.42
750
- total: 4443.52
751
- comments: >
752
- Late afternoon is best.
753
- Backup contact is Nancy
754
- Billsmer @ 338-4338.
755
- php: |
756
- array(
757
- 'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
758
- 'bill-to' =>
759
- array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
760
- , 'ship-to' =>
761
- array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
762
- , 'product' =>
763
- array(
764
- array( 'sku' => 'BL394D', 'quantity' => 4, 'description' => 'Basketball', 'price' => 450.00 ),
765
- array( 'sku' => 'BL4438H', 'quantity' => 1, 'description' => 'Super Hoop', 'price' => 2392.00 )
766
- ),
767
- 'tax' => 251.42, 'total' => 4443.52,
768
- 'comments' => "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.\n"
769
- )
770
- ---
771
- test: Log file
772
- todo: true
773
- spec: 2.28
774
- yaml: |
775
- ---
776
- Time: 2001-11-23 15:01:42 -05:00
777
- User: ed
778
- Warning: >
779
- This is an error message
780
- for the log file
781
- ---
782
- Time: 2001-11-23 15:02:31 -05:00
783
- User: ed
784
- Warning: >
785
- A slightly different error
786
- message.
787
- ---
788
- Date: 2001-11-23 15:03:17 -05:00
789
- User: ed
790
- Fatal: >
791
- Unknown variable "bar"
792
- Stack:
793
- - file: TopClass.py
794
- line: 23
795
- code: |
796
- x = MoreObject("345\n")
797
- - file: MoreClass.py
798
- line: 58
799
- code: |-
800
- foo = bar
801
- ruby: |
802
- y = YAML::Stream.new
803
- y.add( { 'Time' => YAML::mktime( 2001, 11, 23, 15, 01, 42, 00, "-05:00" ),
804
- 'User' => 'ed', 'Warning' => "This is an error message for the log file\n" } )
805
- y.add( { 'Time' => YAML::mktime( 2001, 11, 23, 15, 02, 31, 00, "-05:00" ),
806
- 'User' => 'ed', 'Warning' => "A slightly different error message.\n" } )
807
- y.add( { 'Date' => YAML::mktime( 2001, 11, 23, 15, 03, 17, 00, "-05:00" ),
808
- 'User' => 'ed', 'Fatal' => "Unknown variable \"bar\"\n",
809
- 'Stack' => [
810
- { 'file' => 'TopClass.py', 'line' => 23, 'code' => "x = MoreObject(\"345\\n\")\n" },
811
- { 'file' => 'MoreClass.py', 'line' => 58, 'code' => "foo = bar" } ] } )
812
- documents: 3
813
-
814
- ---
815
- test: Throwaway comments
816
- yaml: |
817
- ### These are four throwaway comment ###
818
-
819
- ### lines (the second line is empty). ###
820
- this: | # Comments may trail lines.
821
- contains three lines of text.
822
- The third one starts with a
823
- # character. This isn't a comment.
824
-
825
- # These are three throwaway comment
826
- # lines (the first line is empty).
827
- php: |
828
- array(
829
- 'this' => "contains three lines of text.\nThe third one starts with a\n# character. This isn't a comment.\n"
830
- )
831
- ---
832
- test: Document with a single value
833
- todo: true
834
- yaml: |
835
- --- >
836
- This YAML stream contains a single text value.
837
- The next stream is a log file - a sequence of
838
- log entries. Adding an entry to the log is a
839
- simple matter of appending it at the end.
840
- ruby: |
841
- "This YAML stream contains a single text value. The next stream is a log file - a sequence of log entries. Adding an entry to the log is a simple matter of appending it at the end.\n"
842
- ---
843
- test: Document stream
844
- todo: true
845
- yaml: |
846
- ---
847
- at: 2001-08-12 09:25:00.00 Z
848
- type: GET
849
- HTTP: '1.0'
850
- url: '/index.html'
851
- ---
852
- at: 2001-08-12 09:25:10.00 Z
853
- type: GET
854
- HTTP: '1.0'
855
- url: '/toc.html'
856
- ruby: |
857
- y = YAML::Stream.new
858
- y.add( {
859
- 'at' => Time::utc( 2001, 8, 12, 9, 25, 00 ),
860
- 'type' => 'GET',
861
- 'HTTP' => '1.0',
862
- 'url' => '/index.html'
863
- } )
864
- y.add( {
865
- 'at' => Time::utc( 2001, 8, 12, 9, 25, 10 ),
866
- 'type' => 'GET',
867
- 'HTTP' => '1.0',
868
- 'url' => '/toc.html'
869
- } )
870
- documents: 2
871
-
872
- ---
873
- test: Top level mapping
874
- yaml: |
875
- # This stream is an example of a top-level mapping.
876
- invoice : 34843
877
- date : 2001-01-23
878
- total : 4443.52
879
- php: |
880
- array(
881
- 'invoice' => 34843,
882
- 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
883
- 'total' => 4443.52
884
- )
885
- ---
886
- test: Single-line documents
887
- todo: true
888
- yaml: |
889
- # The following is a sequence of three documents.
890
- # The first contains an empty mapping, the second
891
- # an empty sequence, and the last an empty string.
892
- --- {}
893
- --- [ ]
894
- --- ''
895
- ruby: |
896
- y = YAML::Stream.new
897
- y.add( {} )
898
- y.add( [] )
899
- y.add( '' )
900
- documents: 3
901
-
902
- ---
903
- test: Document with pause
904
- todo: true
905
- yaml: |
906
- # A communication channel based on a YAML stream.
907
- ---
908
- sent at: 2002-06-06 11:46:25.10 Z
909
- payload: Whatever
910
- # Receiver can process this as soon as the following is sent:
911
- ...
912
- # Even if the next message is sent long after:
913
- ---
914
- sent at: 2002-06-06 12:05:53.47 Z
915
- payload: Whatever
916
- ...
917
- ruby: |
918
- y = YAML::Stream.new
919
- y.add(
920
- { 'sent at' => YAML::mktime( 2002, 6, 6, 11, 46, 25, 0.10 ),
921
- 'payload' => 'Whatever' }
922
- )
923
- y.add(
924
- { "payload" => "Whatever", "sent at" => YAML::mktime( 2002, 6, 6, 12, 5, 53, 0.47 ) }
925
- )
926
- documents: 2
927
-
928
- ---
929
- test: Explicit typing
930
- yaml: |
931
- integer: 12
932
- also int: ! "12"
933
- string: !str 12
934
- php: |
935
- array( 'integer' => 12, 'also int' => 12, 'string' => '12' )
936
- ---
937
- test: Private types
938
- todo: true
939
- yaml: |
940
- # Both examples below make use of the 'x-private:ball'
941
- # type family URI, but with different semantics.
942
- ---
943
- pool: !!ball
944
- number: 8
945
- color: black
946
- ---
947
- bearing: !!ball
948
- material: steel
949
- ruby: |
950
- y = YAML::Stream.new
951
- y.add( { 'pool' =>
952
- YAML::PrivateType.new( 'ball',
953
- { 'number' => 8, 'color' => 'black' } ) }
954
- )
955
- y.add( { 'bearing' =>
956
- YAML::PrivateType.new( 'ball',
957
- { 'material' => 'steel' } ) }
958
- )
959
- documents: 2
960
-
961
- ---
962
- test: Type family under yaml.org
963
- yaml: |
964
- # The URI is 'tag:yaml.org,2002:str'
965
- - !str a Unicode string
966
- php: |
967
- array( 'a Unicode string' )
968
- ---
969
- test: Type family under perl.yaml.org
970
- todo: true
971
- yaml: |
972
- # The URI is 'tag:perl.yaml.org,2002:Text::Tabs'
973
- - !perl/Text::Tabs {}
974
- ruby: |
975
- [ YAML::DomainType.new( 'perl.yaml.org,2002', 'Text::Tabs', {} ) ]
976
- ---
977
- test: Type family under clarkevans.com
978
- todo: true
979
- yaml: |
980
- # The URI is 'tag:clarkevans.com,2003-02:timesheet'
981
- - !clarkevans.com,2003-02/timesheet {}
982
- ruby: |
983
- [ YAML::DomainType.new( 'clarkevans.com,2003-02', 'timesheet', {} ) ]
984
- ---
985
- test: URI Escaping
986
- todo: true
987
- yaml: |
988
- same:
989
- - !domain.tld,2002/type\x30 value
990
- - !domain.tld,2002/type0 value
991
- different: # As far as the YAML parser is concerned
992
- - !domain.tld,2002/type%30 value
993
- - !domain.tld,2002/type0 value
994
- ruby-setup: |
995
- YAML.add_domain_type( "domain.tld,2002", "type0" ) { |type, val|
996
- "ONE: #{val}"
997
- }
998
- YAML.add_domain_type( "domain.tld,2002", "type%30" ) { |type, val|
999
- "TWO: #{val}"
1000
- }
1001
- ruby: |
1002
- { 'same' => [ 'ONE: value', 'ONE: value' ], 'different' => [ 'TWO: value', 'ONE: value' ] }
1003
- ---
1004
- test: URI Prefixing
1005
- todo: true
1006
- yaml: |
1007
- # 'tag:domain.tld,2002:invoice' is some type family.
1008
- invoice: !domain.tld,2002/^invoice
1009
- # 'seq' is shorthand for 'tag:yaml.org,2002:seq'.
1010
- # This does not effect '^customer' below
1011
- # because it is does not specify a prefix.
1012
- customers: !seq
1013
- # '^customer' is shorthand for the full
1014
- # notation 'tag:domain.tld,2002:customer'.
1015
- - !^customer
1016
- given : Chris
1017
- family : Dumars
1018
- ruby-setup: |
1019
- YAML.add_domain_type( "domain.tld,2002", /(invoice|customer)/ ) { |type, val|
1020
- if val.is_a? ::Hash
1021
- scheme, domain, type = type.split( /:/, 3 )
1022
- val['type'] = "domain #{type}"
1023
- val
1024
- else
1025
- raise YAML::Error, "Not a Hash in domain.tld/invoice: " + val.inspect
1026
- end
1027
- }
1028
- ruby: |
1029
- { "invoice"=> { "customers"=> [ { "given"=>"Chris", "type"=>"domain customer", "family"=>"Dumars" } ], "type"=>"domain invoice" } }
1030
-
1031
- ---
1032
- test: Overriding anchors
1033
- yaml: |
1034
- anchor : &A001 This scalar has an anchor.
1035
- override : &A001 >
1036
- The alias node below is a
1037
- repeated use of this value.
1038
- alias : *A001
1039
- php: |
1040
- array( 'anchor' => 'This scalar has an anchor.',
1041
- 'override' => "The alias node below is a repeated use of this value.\n",
1042
- 'alias' => "The alias node below is a repeated use of this value.\n" )
1043
- ---
1044
- test: Flow and block formatting
1045
- todo: true
1046
- yaml: |
1047
- empty: []
1048
- flow: [ one, two, three # May span lines,
1049
- , four, # indentation is
1050
- five ] # mostly ignored.
1051
- block:
1052
- - First item in top sequence
1053
- -
1054
- - Subordinate sequence entry
1055
- - >
1056
- A folded sequence entry
1057
- - Sixth item in top sequence
1058
- ruby: |
1059
- { 'empty' => [], 'flow' => [ 'one', 'two', 'three', 'four', 'five' ],
1060
- 'block' => [ 'First item in top sequence', [ 'Subordinate sequence entry' ],
1061
- "A folded sequence entry\n", 'Sixth item in top sequence' ] }
1062
- ---
1063
- test: Complete mapping test
1064
- todo: true
1065
- yaml: |
1066
- empty: {}
1067
- flow: { one: 1, two: 2 }
1068
- spanning: { one: 1,
1069
- two: 2 }
1070
- block:
1071
- first : First entry
1072
- second:
1073
- key: Subordinate mapping
1074
- third:
1075
- - Subordinate sequence
1076
- - { }
1077
- - Previous mapping is empty.
1078
- - A key: value pair in a sequence.
1079
- A second: key:value pair.
1080
- - The previous entry is equal to the following one.
1081
- -
1082
- A key: value pair in a sequence.
1083
- A second: key:value pair.
1084
- !float 12 : This key is a float.
1085
- ? >
1086
- ?
1087
- : This key had to be protected.
1088
- "\a" : This key had to be escaped.
1089
- ? >
1090
- This is a
1091
- multi-line
1092
- folded key
1093
- : Whose value is
1094
- also multi-line.
1095
- ? this also works as a key
1096
- : with a value at the next line.
1097
- ?
1098
- - This key
1099
- - is a sequence
1100
- :
1101
- - With a sequence value.
1102
- ?
1103
- This: key
1104
- is a: mapping
1105
- :
1106
- with a: mapping value.
1107
- ruby: |
1108
- { 'empty' => {}, 'flow' => { 'one' => 1, 'two' => 2 },
1109
- 'spanning' => { 'one' => 1, 'two' => 2 },
1110
- 'block' => { 'first' => 'First entry', 'second' =>
1111
- { 'key' => 'Subordinate mapping' }, 'third' =>
1112
- [ 'Subordinate sequence', {}, 'Previous mapping is empty.',
1113
- { 'A key' => 'value pair in a sequence.', 'A second' => 'key:value pair.' },
1114
- 'The previous entry is equal to the following one.',
1115
- { 'A key' => 'value pair in a sequence.', 'A second' => 'key:value pair.' } ],
1116
- 12.0 => 'This key is a float.', "?\n" => 'This key had to be protected.',
1117
- "\a" => 'This key had to be escaped.',
1118
- "This is a multi-line folded key\n" => "Whose value is also multi-line.",
1119
- 'this also works as a key' => 'with a value at the next line.',
1120
- [ 'This key', 'is a sequence' ] => [ 'With a sequence value.' ] } }
1121
- # Couldn't recreate map exactly, so we'll do a detailed check to be sure it's entact
1122
- obj_y['block'].keys.each { |k|
1123
- if Hash === k
1124
- v = obj_y['block'][k]
1125
- if k['This'] == 'key' and k['is a'] == 'mapping' and v['with a'] == 'mapping value.'
1126
- obj_r['block'][k] = v
1127
- end
1128
- end
1129
- }
1130
- ---
1131
- test: Literal explicit indentation
1132
- yaml: |
1133
- # Explicit indentation must
1134
- # be given in all the three
1135
- # following cases.
1136
- leading spaces: |2
1137
- This value starts with four spaces.
1138
-
1139
- leading line break: |2
1140
-
1141
- This value starts with a line break.
1142
-
1143
- leading comment indicator: |2
1144
- # first line starts with a
1145
- # character.
1146
-
1147
- # Explicit indentation may
1148
- # also be given when it is
1149
- # not required.
1150
- redundant: |2
1151
- This value is indented 2 spaces.
1152
- php: |
1153
- array(
1154
- 'leading spaces' => " This value starts with four spaces.\n",
1155
- 'leading line break' => "\nThis value starts with a line break.\n",
1156
- 'leading comment indicator' => "# first line starts with a\n# character.\n",
1157
- 'redundant' => "This value is indented 2 spaces.\n"
1158
- )
1159
- ---
1160
- test: Chomping and keep modifiers
1161
- yaml: |
1162
- clipped: |
1163
- This has one newline.
1164
-
1165
- same as "clipped" above: "This has one newline.\n"
1166
-
1167
- stripped: |-
1168
- This has no newline.
1169
-
1170
- same as "stripped" above: "This has no newline."
1171
-
1172
- kept: |+
1173
- This has two newlines.
1174
-
1175
- same as "kept" above: "This has two newlines.\n\n"
1176
- php: |
1177
- array(
1178
- 'clipped' => "This has one newline.\n",
1179
- 'same as "clipped" above' => "This has one newline.\n",
1180
- 'stripped' => 'This has no newline.',
1181
- 'same as "stripped" above' => 'This has no newline.',
1182
- 'kept' => "This has two newlines.\n\n",
1183
- 'same as "kept" above' => "This has two newlines.\n\n"
1184
- )
1185
- ---
1186
- test: Literal combinations
1187
- todo: true
1188
- yaml: |
1189
- empty: |
1190
-
1191
- literal: |
1192
- The \ ' " characters may be
1193
- freely used. Leading white
1194
- space is significant.
1195
-
1196
- Line breaks are significant.
1197
- Thus this value contains one
1198
- empty line and ends with a
1199
- single line break, but does
1200
- not start with one.
1201
-
1202
- is equal to: "The \\ ' \" characters may \
1203
- be\nfreely used. Leading white\n space \
1204
- is significant.\n\nLine breaks are \
1205
- significant.\nThus this value contains \
1206
- one\nempty line and ends with a\nsingle \
1207
- line break, but does\nnot start with one.\n"
1208
-
1209
- # Comments may follow a block
1210
- # scalar value. They must be
1211
- # less indented.
1212
-
1213
- # Modifiers may be combined in any order.
1214
- indented and chomped: |2-
1215
- This has no newline.
1216
-
1217
- also written as: |-2
1218
- This has no newline.
1219
-
1220
- both are equal to: " This has no newline."
1221
- php: |
1222
- array(
1223
- 'empty' => '',
1224
- 'literal' => "The \\ ' \" characters may be\nfreely used. Leading white\n space " +
1225
- "is significant.\n\nLine breaks are significant.\nThus this value contains one\n" +
1226
- "empty line and ends with a\nsingle line break, but does\nnot start with one.\n",
1227
- 'is equal to' => "The \\ ' \" characters may be\nfreely used. Leading white\n space " +
1228
- "is significant.\n\nLine breaks are significant.\nThus this value contains one\n" +
1229
- "empty line and ends with a\nsingle line break, but does\nnot start with one.\n",
1230
- 'indented and chomped' => ' This has no newline.',
1231
- 'also written as' => ' This has no newline.',
1232
- 'both are equal to' => ' This has no newline.'
1233
- )
1234
- ---
1235
- test: Folded combinations
1236
- todo: true
1237
- yaml: |
1238
- empty: >
1239
-
1240
- one paragraph: >
1241
- Line feeds are converted
1242
- to spaces, so this value
1243
- contains no line breaks
1244
- except for the final one.
1245
-
1246
- multiple paragraphs: >2
1247
-
1248
- An empty line, either
1249
- at the start or in
1250
- the value:
1251
-
1252
- Is interpreted as a
1253
- line break. Thus this
1254
- value contains three
1255
- line breaks.
1256
-
1257
- indented text: >
1258
- This is a folded
1259
- paragraph followed
1260
- by a list:
1261
- * first entry
1262
- * second entry
1263
- Followed by another
1264
- folded paragraph,
1265
- another list:
1266
-
1267
- * first entry
1268
-
1269
- * second entry
1270
-
1271
- And a final folded
1272
- paragraph.
1273
-
1274
- above is equal to: |
1275
- This is a folded paragraph followed by a list:
1276
- * first entry
1277
- * second entry
1278
- Followed by another folded paragraph, another list:
1279
-
1280
- * first entry
1281
-
1282
- * second entry
1283
-
1284
- And a final folded paragraph.
1285
-
1286
- # Explicit comments may follow
1287
- # but must be less indented.
1288
- php: |
1289
- array(
1290
- 'empty' => '',
1291
- 'one paragraph' => 'Line feeds are converted to spaces, so this value'.
1292
- " contains no line breaks except for the final one.\n",
1293
- 'multiple paragraphs' => "\nAn empty line, either at the start or in the value:\n".
1294
- "Is interpreted as a line break. Thus this value contains three line breaks.\n",
1295
- 'indented text' => "This is a folded paragraph followed by a list:\n".
1296
- " * first entry\n * second entry\nFollowed by another folded paragraph, ".
1297
- "another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n",
1298
- 'above is equal to' => "This is a folded paragraph followed by a list:\n".
1299
- " * first entry\n * second entry\nFollowed by another folded paragraph, ".
1300
- "another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n"
1301
- )
1302
- ---
1303
- test: Single quotes
1304
- todo: true
1305
- yaml: |
1306
- empty: ''
1307
- second: '! : \ etc. can be used freely.'
1308
- third: 'a single quote '' must be escaped.'
1309
- span: 'this contains
1310
- six spaces
1311
-
1312
- and one
1313
- line break'
1314
- is same as: "this contains six spaces\nand one line break"
1315
- php: |
1316
- array(
1317
- 'empty' => '',
1318
- 'second' => '! : \\ etc. can be used freely.',
1319
- 'third' => "a single quote ' must be escaped.",
1320
- 'span' => "this contains six spaces\nand one line break",
1321
- 'is same as' => "this contains six spaces\nand one line break"
1322
- )
1323
- ---
1324
- test: Double quotes
1325
- todo: true
1326
- yaml: |
1327
- empty: ""
1328
- second: "! : etc. can be used freely."
1329
- third: "a \" or a \\ must be escaped."
1330
- fourth: "this value ends with an LF.\n"
1331
- span: "this contains
1332
- four \
1333
- spaces"
1334
- is equal to: "this contains four spaces"
1335
- php: |
1336
- array(
1337
- 'empty' => '',
1338
- 'second' => '! : etc. can be used freely.',
1339
- 'third' => 'a " or a \\ must be escaped.',
1340
- 'fourth' => "this value ends with an LF.\n",
1341
- 'span' => "this contains four spaces",
1342
- 'is equal to' => "this contains four spaces"
1343
- )
1344
- ---
1345
- test: Unquoted strings
1346
- todo: true
1347
- yaml: |
1348
- first: There is no unquoted empty string.
1349
-
1350
- second: 12 ## This is an integer.
1351
-
1352
- third: !str 12 ## This is a string.
1353
-
1354
- span: this contains
1355
- six spaces
1356
-
1357
- and one
1358
- line break
1359
-
1360
- indicators: this has no comments.
1361
- #:foo and bar# are
1362
- both text.
1363
-
1364
- flow: [ can span
1365
- lines, # comment
1366
- like
1367
- this ]
1368
-
1369
- note: { one-line keys: but multi-line values }
1370
-
1371
- php: |
1372
- array(
1373
- 'first' => 'There is no unquoted empty string.',
1374
- 'second' => 12,
1375
- 'third' => '12',
1376
- 'span' => "this contains six spaces\nand one line break",
1377
- 'indicators' => "this has no comments. #:foo and bar# are both text.",
1378
- 'flow' => [ 'can span lines', 'like this' ],
1379
- 'note' => { 'one-line keys' => 'but multi-line values' }
1380
- )
1381
- ---
1382
- test: Spanning sequences
1383
- todo: true
1384
- yaml: |
1385
- # The following are equal seqs
1386
- # with different identities.
1387
- flow: [ one, two ]
1388
- spanning: [ one,
1389
- two ]
1390
- block:
1391
- - one
1392
- - two
1393
- php: |
1394
- array(
1395
- 'flow' => [ 'one', 'two' ],
1396
- 'spanning' => [ 'one', 'two' ],
1397
- 'block' => [ 'one', 'two' ]
1398
- )
1399
- ---
1400
- test: Flow mappings
1401
- yaml: |
1402
- # The following are equal maps
1403
- # with different identities.
1404
- flow: { one: 1, two: 2 }
1405
- block:
1406
- one: 1
1407
- two: 2
1408
- php: |
1409
- array(
1410
- 'flow' => array( 'one' => 1, 'two' => 2 ),
1411
- 'block' => array( 'one' => 1, 'two' => 2 )
1412
- )
1413
- ---
1414
- test: Representations of 12
1415
- todo: true
1416
- yaml: |
1417
- - 12 # An integer
1418
- # The following scalars
1419
- # are loaded to the
1420
- # string value '1' '2'.
1421
- - !str 12
1422
- - '12'
1423
- - "12"
1424
- - "\
1425
- 1\
1426
- 2\
1427
- "
1428
- # Strings containing paths and regexps can be unquoted:
1429
- - /foo/bar
1430
- - d:/foo/bar
1431
- - foo/bar
1432
- - /a.*b/
1433
- php: |
1434
- array( 12, '12', '12', '12', '12', '/foo/bar', 'd:/foo/bar', 'foo/bar', '/a.*b/' )
1435
- ---
1436
- test: "Null"
1437
- todo: true
1438
- yaml: |
1439
- canonical: ~
1440
-
1441
- english: null
1442
-
1443
- # This sequence has five
1444
- # entries, two with values.
1445
- sparse:
1446
- - ~
1447
- - 2nd entry
1448
- - Null
1449
- - 4th entry
1450
- -
1451
-
1452
- four: This mapping has five keys,
1453
- only two with values.
1454
-
1455
- php: |
1456
- array (
1457
- 'canonical' => null,
1458
- 'english' => null,
1459
- 'sparse' => array( null, '2nd entry', null, '4th entry', null ]),
1460
- 'four' => 'This mapping has five keys, only two with values.'
1461
- )
1462
- ---
1463
- test: Omap
1464
- todo: true
1465
- yaml: |
1466
- # Explicitly typed dictionary.
1467
- Bestiary: !omap
1468
- - aardvark: African pig-like ant eater. Ugly.
1469
- - anteater: South-American ant eater. Two species.
1470
- - anaconda: South-American constrictor snake. Scary.
1471
- # Etc.
1472
- ruby: |
1473
- {
1474
- 'Bestiary' => YAML::Omap[
1475
- 'aardvark', 'African pig-like ant eater. Ugly.',
1476
- 'anteater', 'South-American ant eater. Two species.',
1477
- 'anaconda', 'South-American constrictor snake. Scary.'
1478
- ]
1479
- }
1480
-
1481
- ---
1482
- test: Pairs
1483
- todo: true
1484
- yaml: |
1485
- # Explicitly typed pairs.
1486
- tasks: !pairs
1487
- - meeting: with team.
1488
- - meeting: with boss.
1489
- - break: lunch.
1490
- - meeting: with client.
1491
- ruby: |
1492
- {
1493
- 'tasks' => YAML::Pairs[
1494
- 'meeting', 'with team.',
1495
- 'meeting', 'with boss.',
1496
- 'break', 'lunch.',
1497
- 'meeting', 'with client.'
1498
- ]
1499
- }
1500
-
1501
- ---
1502
- test: Set
1503
- todo: true
1504
- yaml: |
1505
- # Explicitly typed set.
1506
- baseball players: !set
1507
- Mark McGwire:
1508
- Sammy Sosa:
1509
- Ken Griffey:
1510
- ruby: |
1511
- {
1512
- 'baseball players' => YAML::Set[
1513
- 'Mark McGwire', nil,
1514
- 'Sammy Sosa', nil,
1515
- 'Ken Griffey', nil
1516
- ]
1517
- }
1518
-
1519
- ---
1520
- test: Boolean
1521
- yaml: |
1522
- false: used as key
1523
- logical: true
1524
- answer: false
1525
- php: |
1526
- array(
1527
- false => 'used as key',
1528
- 'logical' => true,
1529
- 'answer' => false
1530
- )
1531
- ---
1532
- test: Integer
1533
- yaml: |
1534
- canonical: 12345
1535
- decimal: +12,345
1536
- octal: 014
1537
- hexadecimal: 0xC
1538
- php: |
1539
- array(
1540
- 'canonical' => 12345,
1541
- 'decimal' => 12345.0,
1542
- 'octal' => 12,
1543
- 'hexadecimal' => 12
1544
- )
1545
- ---
1546
- test: Float
1547
- yaml: |
1548
- canonical: 1.23015e+3
1549
- exponential: 12.3015e+02
1550
- fixed: 1,230.15
1551
- negative infinity: -.inf
1552
- not a number: .NaN
1553
- php: |
1554
- array(
1555
- 'canonical' => 1230.15,
1556
- 'exponential' => 1230.15,
1557
- 'fixed' => 1230.15,
1558
- 'negative infinity' => log(0),
1559
- 'not a number' => -log(0)
1560
- )
1561
- ---
1562
- test: Timestamp
1563
- todo: true
1564
- yaml: |
1565
- canonical: 2001-12-15T02:59:43.1Z
1566
- valid iso8601: 2001-12-14t21:59:43.10-05:00
1567
- space separated: 2001-12-14 21:59:43.10 -05:00
1568
- date (noon UTC): 2002-12-14
1569
- ruby: |
1570
- array(
1571
- 'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),
1572
- 'valid iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
1573
- 'space separated' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
1574
- 'date (noon UTC)' => Date.new( 2002, 12, 14 )
1575
- )
1576
- ---
1577
- test: Binary
1578
- todo: true
1579
- yaml: |
1580
- canonical: !binary "\
1581
- R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\
1582
- OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\
1583
- +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\
1584
- AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs="
1585
- base64: !binary |
1586
- R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
1587
- OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
1588
- +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC
1589
- AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
1590
- description: >
1591
- The binary value above is a tiny arrow
1592
- encoded as a gif image.
1593
- ruby-setup: |
1594
- arrow_gif = "GIF89a\f\000\f\000\204\000\000\377\377\367\365\365\356\351\351\345fff\000\000\000\347\347\347^^^\363\363\355\216\216\216\340\340\340\237\237\237\223\223\223\247\247\247\236\236\236iiiccc\243\243\243\204\204\204\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371!\376\016Made with GIMP\000,\000\000\000\000\f\000\f\000\000\005, \216\2010\236\343@\024\350i\020\304\321\212\010\034\317\200M$z\357\3770\205p\270\2601f\r\e\316\001\303\001\036\020' \202\n\001\000;"
1595
- ruby: |
1596
- {
1597
- 'canonical' => arrow_gif,
1598
- 'base64' => arrow_gif,
1599
- 'description' => "The binary value above is a tiny arrow encoded as a gif image.\n"
1600
- }
1601
-
1602
- ---
1603
- test: Merge key
1604
- todo: true
1605
- yaml: |
1606
- ---
1607
- - &CENTER { x: 1, y: 2 }
1608
- - &LEFT { x: 0, y: 2 }
1609
- - &BIG { r: 10 }
1610
- - &SMALL { r: 1 }
1611
-
1612
- # All the following maps are equal:
1613
-
1614
- - # Explicit keys
1615
- x: 1
1616
- y: 2
1617
- r: 10
1618
- label: center/big
1619
-
1620
- - # Merge one map
1621
- << : *CENTER
1622
- r: 10
1623
- label: center/big
1624
-
1625
- - # Merge multiple maps
1626
- << : [ *CENTER, *BIG ]
1627
- label: center/big
1628
-
1629
- - # Override
1630
- << : [ *BIG, *LEFT, *SMALL ]
1631
- x: 1
1632
- label: center/big
1633
-
1634
- ruby-setup: |
1635
- center = { 'x' => 1, 'y' => 2 }
1636
- left = { 'x' => 0, 'y' => 2 }
1637
- big = { 'r' => 10 }
1638
- small = { 'r' => 1 }
1639
- node1 = { 'x' => 1, 'y' => 2, 'r' => 10, 'label' => 'center/big' }
1640
- node2 = center.dup
1641
- node2.update( { 'r' => 10, 'label' => 'center/big' } )
1642
- node3 = big.dup
1643
- node3.update( center )
1644
- node3.update( { 'label' => 'center/big' } )
1645
- node4 = small.dup
1646
- node4.update( left )
1647
- node4.update( big )
1648
- node4.update( { 'x' => 1, 'label' => 'center/big' } )
1649
-
1650
- ruby: |
1651
- [
1652
- center, left, big, small, node1, node2, node3, node4
1653
- ]
1654
-
1655
- ---
1656
- test: Default key
1657
- todo: true
1658
- yaml: |
1659
- --- # Old schema
1660
- link with:
1661
- - library1.dll
1662
- - library2.dll
1663
- --- # New schema
1664
- link with:
1665
- - = : library1.dll
1666
- version: 1.2
1667
- - = : library2.dll
1668
- version: 2.3
1669
- ruby: |
1670
- y = YAML::Stream.new
1671
- y.add( { 'link with' => [ 'library1.dll', 'library2.dll' ] } )
1672
- obj_h = Hash[ 'version' => 1.2 ]
1673
- obj_h.default = 'library1.dll'
1674
- obj_h2 = Hash[ 'version' => 2.3 ]
1675
- obj_h2.default = 'library2.dll'
1676
- y.add( { 'link with' => [ obj_h, obj_h2 ] } )
1677
- documents: 2
1678
-
1679
- ---
1680
- test: Special keys
1681
- todo: true
1682
- yaml: |
1683
- "!": These three keys
1684
- "&": had to be quoted
1685
- "=": and are normal strings.
1686
- # NOTE: the following node should NOT be serialized this way.
1687
- encoded node :
1688
- !special '!' : '!type'
1689
- !special|canonical '&' : 12
1690
- = : value
1691
- # The proper way to serialize the above node is as follows:
1692
- node : !!type &12 value
1693
- ruby: |
1694
- { '!' => 'These three keys', '&' => 'had to be quoted',
1695
- '=' => 'and are normal strings.',
1696
- 'encoded node' => YAML::PrivateType.new( 'type', 'value' ),
1697
- 'node' => YAML::PrivateType.new( 'type', 'value' ) }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml DELETED
@@ -1,244 +0,0 @@
1
- --- %YAML:1.0
2
- test: Strings
3
- brief: >
4
- Any group of characters beginning with an
5
- alphabetic or numeric character is a string,
6
- unless it belongs to one of the groups below
7
- (such as an Integer or Time).
8
- yaml: |
9
- String
10
- php: |
11
- 'String'
12
- ---
13
- test: String characters
14
- brief: >
15
- A string can contain any alphabetic or
16
- numeric character, along with many
17
- punctuation characters, including the
18
- period, dash, space, quotes, exclamation, and
19
- question mark.
20
- yaml: |
21
- - What's Yaml?
22
- - It's for writing data structures in plain text.
23
- - And?
24
- - And what? That's not good enough for you?
25
- - No, I mean, "And what about Yaml?"
26
- - Oh, oh yeah. Uh.. Yaml for Ruby.
27
- php: |
28
- array(
29
- "What's Yaml?",
30
- "It's for writing data structures in plain text.",
31
- "And?",
32
- "And what? That's not good enough for you?",
33
- "No, I mean, \"And what about Yaml?\"",
34
- "Oh, oh yeah. Uh.. Yaml for Ruby."
35
- )
36
- ---
37
- test: Indicators in Strings
38
- brief: >
39
- Be careful using indicators in strings. In particular,
40
- the comma, colon, and pound sign must be used carefully.
41
- yaml: |
42
- the colon followed by space is an indicator: but is a string:right here
43
- same for the pound sign: here we have it#in a string
44
- the comma can, honestly, be used in most cases: [ but not in, inline collections ]
45
- php: |
46
- array(
47
- 'the colon followed by space is an indicator' => 'but is a string:right here',
48
- 'same for the pound sign' => 'here we have it#in a string',
49
- 'the comma can, honestly, be used in most cases' => array('but not in', 'inline collections')
50
- )
51
- ---
52
- test: Forcing Strings
53
- brief: >
54
- Any YAML type can be forced into a string using the
55
- explicit !str method.
56
- yaml: |
57
- date string: !str 2001-08-01
58
- number string: !str 192
59
- php: |
60
- array(
61
- 'date string' => '2001-08-01',
62
- 'number string' => '192'
63
- )
64
- ---
65
- test: Single-quoted Strings
66
- brief: >
67
- You can also enclose your strings within single quotes,
68
- which allows use of slashes, colons, and other indicators
69
- freely. Inside single quotes, you can represent a single
70
- quote in your string by using two single quotes next to
71
- each other.
72
- yaml: |
73
- all my favorite symbols: '#:!/%.)'
74
- a few i hate: '&(*'
75
- why do i hate them?: 'it''s very hard to explain'
76
- entities: '&pound; me'
77
- php: |
78
- array(
79
- 'all my favorite symbols' => '#:!/%.)',
80
- 'a few i hate' => '&(*',
81
- 'why do i hate them?' => 'it\'s very hard to explain',
82
- 'entities' => '&pound; me'
83
- )
84
- ---
85
- test: Double-quoted Strings
86
- brief: >
87
- Enclosing strings in double quotes allows you
88
- to use escapings to represent ASCII and
89
- Unicode characters.
90
- yaml: |
91
- i know where i want my line breaks: "one here\nand another here\n"
92
- php: |
93
- array(
94
- 'i know where i want my line breaks' => "one here\nand another here\n"
95
- )
96
- ---
97
- test: Multi-line Quoted Strings
98
- todo: true
99
- brief: >
100
- Both single- and double-quoted strings may be
101
- carried on to new lines in your YAML document.
102
- They must be indented a step and indentation
103
- is interpreted as a single space.
104
- yaml: |
105
- i want a long string: "so i'm going to
106
- let it go on and on to other lines
107
- until i end it with a quote."
108
- php: |
109
- array('i want a long string' => "so i'm going to ".
110
- "let it go on and on to other lines ".
111
- "until i end it with a quote."
112
- )
113
-
114
- ---
115
- test: Plain scalars
116
- todo: true
117
- brief: >
118
- Unquoted strings may also span multiple lines, if they
119
- are free of YAML space indicators and indented.
120
- yaml: |
121
- - My little toe is broken in two places;
122
- - I'm crazy to have skied this way;
123
- - I'm not the craziest he's seen, since there was always the German guy
124
- who skied for 3 hours on a broken shin bone (just below the kneecap);
125
- - Nevertheless, second place is respectable, and he doesn't
126
- recommend going for the record;
127
- - He's going to put my foot in plaster for a month;
128
- - This would impair my skiing ability somewhat for the
129
- duration, as can be imagined.
130
- php: |
131
- array(
132
- "My little toe is broken in two places;",
133
- "I'm crazy to have skied this way;",
134
- "I'm not the craziest he's seen, since there was always ".
135
- "the German guy who skied for 3 hours on a broken shin ".
136
- "bone (just below the kneecap);",
137
- "Nevertheless, second place is respectable, and he doesn't ".
138
- "recommend going for the record;",
139
- "He's going to put my foot in plaster for a month;",
140
- "This would impair my skiing ability somewhat for the duration, ".
141
- "as can be imagined."
142
- )
143
- ---
144
- test: 'Null'
145
- brief: >
146
- You can use the tilde '~' character for a null value.
147
- yaml: |
148
- name: Mr. Show
149
- hosted by: Bob and David
150
- date of next season: ~
151
- php: |
152
- array(
153
- 'name' => 'Mr. Show',
154
- 'hosted by' => 'Bob and David',
155
- 'date of next season' => null
156
- )
157
- ---
158
- test: Boolean
159
- brief: >
160
- You can use 'true' and 'false' for Boolean values.
161
- yaml: |
162
- Is Gus a Liar?: true
163
- Do I rely on Gus for Sustenance?: false
164
- php: |
165
- array(
166
- 'Is Gus a Liar?' => true,
167
- 'Do I rely on Gus for Sustenance?' => false
168
- )
169
- ---
170
- test: Integers
171
- dump_skip: true
172
- brief: >
173
- An integer is a series of numbers, optionally
174
- starting with a positive or negative sign. Integers
175
- may also contain commas for readability.
176
- yaml: |
177
- zero: 0
178
- simple: 12
179
- one-thousand: 1,000
180
- negative one-thousand: -1,000
181
- php: |
182
- array(
183
- 'zero' => 0,
184
- 'simple' => 12,
185
- 'one-thousand' => 1000.0,
186
- 'negative one-thousand' => -1000.0
187
- )
188
- ---
189
- test: Integers as Map Keys
190
- brief: >
191
- An integer can be used a dictionary key.
192
- yaml: |
193
- 1: one
194
- 2: two
195
- 3: three
196
- php: |
197
- array(
198
- 1 => 'one',
199
- 2 => 'two',
200
- 3 => 'three'
201
- )
202
- ---
203
- test: Floats
204
- dump_skip: true
205
- brief: >
206
- Floats are represented by numbers with decimals,
207
- allowing for scientific notation, as well as
208
- positive and negative infinity and "not a number."
209
- yaml: |
210
- a simple float: 2.00
211
- larger float: 1,000.09
212
- scientific notation: 1.00009e+3
213
- php: |
214
- array(
215
- 'a simple float' => 2.0,
216
- 'larger float' => 1000.09,
217
- 'scientific notation' => 1000.09
218
- )
219
- ---
220
- test: Time
221
- todo: true
222
- brief: >
223
- You can represent timestamps by using
224
- ISO8601 format, or a variation which
225
- allows spaces between the date, time and
226
- time zone.
227
- yaml: |
228
- iso8601: 2001-12-14t21:59:43.10-05:00
229
- space separated: 2001-12-14 21:59:43.10 -05:00
230
- php: |
231
- array(
232
- 'iso8601' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
233
- 'space separated' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" )
234
- )
235
- ---
236
- test: Date
237
- todo: true
238
- brief: >
239
- A date can be represented by its year,
240
- month and day in ISO8601 order.
241
- yaml: |
242
- 1976-07-31
243
- php: |
244
- date( 1976, 7, 31 )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/embededPhp.yml DELETED
@@ -1 +0,0 @@
1
- value: <?php echo 1 + 2 + 3 ?>
 
vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml DELETED
@@ -1,155 +0,0 @@
1
- test: outside double quotes
2
- yaml: |
3
- \0 \ \a \b \n
4
- php: |
5
- "\\0 \\ \\a \\b \\n"
6
- ---
7
- test: null
8
- yaml: |
9
- "\0"
10
- php: |
11
- "\x00"
12
- ---
13
- test: bell
14
- yaml: |
15
- "\a"
16
- php: |
17
- "\x07"
18
- ---
19
- test: backspace
20
- yaml: |
21
- "\b"
22
- php: |
23
- "\x08"
24
- ---
25
- test: horizontal tab (1)
26
- yaml: |
27
- "\t"
28
- php: |
29
- "\x09"
30
- ---
31
- test: horizontal tab (2)
32
- yaml: |
33
- "\ "
34
- php: |
35
- "\x09"
36
- ---
37
- test: line feed
38
- yaml: |
39
- "\n"
40
- php: |
41
- "\x0a"
42
- ---
43
- test: vertical tab
44
- yaml: |
45
- "\v"
46
- php: |
47
- "\x0b"
48
- ---
49
- test: form feed
50
- yaml: |
51
- "\f"
52
- php: |
53
- "\x0c"
54
- ---
55
- test: carriage return
56
- yaml: |
57
- "\r"
58
- php: |
59
- "\x0d"
60
- ---
61
- test: escape
62
- yaml: |
63
- "\e"
64
- php: |
65
- "\x1b"
66
- ---
67
- test: space
68
- yaml: |
69
- "\ "
70
- php: |
71
- "\x20"
72
- ---
73
- test: slash
74
- yaml: |
75
- "\/"
76
- php: |
77
- "\x2f"
78
- ---
79
- test: backslash
80
- yaml: |
81
- "\\"
82
- php: |
83
- "\\"
84
- ---
85
- test: Unicode next line
86
- yaml: |
87
- "\N"
88
- php: |
89
- "\xc2\x85"
90
- ---
91
- test: Unicode non-breaking space
92
- yaml: |
93
- "\_"
94
- php: |
95
- "\xc2\xa0"
96
- ---
97
- test: Unicode line separator
98
- yaml: |
99
- "\L"
100
- php: |
101
- "\xe2\x80\xa8"
102
- ---
103
- test: Unicode paragraph separator
104
- yaml: |
105
- "\P"
106
- php: |
107
- "\xe2\x80\xa9"
108
- ---
109
- test: Escaped 8-bit Unicode
110
- yaml: |
111
- "\x42"
112
- php: |
113
- "B"
114
- ---
115
- test: Escaped 16-bit Unicode
116
- yaml: |
117
- "\u20ac"
118
- php: |
119
- "\xe2\x82\xac"
120
- ---
121
- test: Escaped 32-bit Unicode
122
- yaml: |
123
- "\U00000043"
124
- php: |
125
- "C"
126
- ---
127
- test: Example 5.13 Escaped Characters
128
- note: |
129
- Currently throws an error parsing first line. Maybe Symfony Yaml doesn't support
130
- continuation of string across multiple lines? Keeping test here but disabled.
131
- todo: true
132
- yaml: |
133
- "Fun with \\
134
- \" \a \b \e \f \
135
- \n \r \t \v \0 \
136
- \ \_ \N \L \P \
137
- \x41 \u0041 \U00000041"
138
- php: |
139
- "Fun with \x5C\n\x22 \x07 \x08 \x1B \x0C\n\x0A \x0D \x09 \x0B \x00\n\x20 \xA0 \x85 \xe2\x80\xa8 \xe2\x80\xa9\nA A A"
140
- ---
141
- test: Double quotes with a line feed
142
- yaml: |
143
- { double: "some value\n \"some quoted string\" and 'some single quotes one'" }
144
- php: |
145
- array(
146
- 'double' => "some value\n \"some quoted string\" and 'some single quotes one'"
147
- )
148
- ---
149
- test: Backslashes
150
- yaml: |
151
- { single: 'foo\Var', no-quotes: foo\Var, double: "foo\\Var" }
152
- php: |
153
- array(
154
- 'single' => 'foo\Var', 'no-quotes' => 'foo\Var', 'double' => 'foo\Var'
155
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/index.yml DELETED
@@ -1,18 +0,0 @@
1
- - escapedCharacters
2
- - sfComments
3
- - sfCompact
4
- - sfTests
5
- - sfObjects
6
- - sfMergeKey
7
- - sfQuotes
8
- - YtsAnchorAlias
9
- - YtsBasicTests
10
- - YtsBlockMapping
11
- - YtsDocumentSeparator
12
- - YtsErrorTests
13
- - YtsFlowCollections
14
- - YtsFoldedScalars
15
- - YtsNullsAndEmpties
16
- - YtsSpecificationExamples
17
- - YtsTypeTransfers
18
- - unindentedCollections
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/sfComments.yml DELETED
@@ -1,76 +0,0 @@
1
- --- %YAML:1.0
2
- test: Comments at the end of a line
3
- brief: >
4
- Comments at the end of a line
5
- yaml: |
6
- ex1: "foo # bar"
7
- ex2: "foo # bar" # comment
8
- ex3: 'foo # bar' # comment
9
- ex4: foo # comment
10
- ex5: foo # comment with tab before
11
- ex6: foo#foo # comment here
12
- ex7: foo # ignore me # and me
13
- php: |
14
- array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo', 'ex5' => 'foo', 'ex6' => 'foo#foo', 'ex7' => 'foo')
15
- ---
16
- test: Comments in the middle
17
- brief: >
18
- Comments in the middle
19
- yaml: |
20
- foo:
21
- # some comment
22
- # some comment
23
- bar: foo
24
- # some comment
25
- # some comment
26
- php: |
27
- array('foo' => array('bar' => 'foo'))
28
- ---
29
- test: Comments on a hash line
30
- brief: >
31
- Comments on a hash line
32
- yaml: |
33
- foo: # a comment
34
- foo: bar # a comment
35
- php: |
36
- array('foo' => array('foo' => 'bar'))
37
- ---
38
- test: 'Value starting with a #'
39
- brief: >
40
- 'Value starting with a #'
41
- yaml: |
42
- foo: '#bar'
43
- php: |
44
- array('foo' => '#bar')
45
- ---
46
- test: Document starting with a comment and a separator
47
- brief: >
48
- Commenting before document start is allowed
49
- yaml: |
50
- # document comment
51
- ---
52
- foo: bar # a comment
53
- php: |
54
- array('foo' => 'bar')
55
- ---
56
- test: Comment containing a colon on a hash line
57
- brief: >
58
- Comment containing a colon on a scalar line
59
- yaml: 'foo # comment: this is also part of the comment'
60
- php: |
61
- 'foo'
62
- ---
63
- test: 'Hash key containing a #'
64
- brief: >
65
- 'Hash key containing a #'
66
- yaml: 'foo#bar: baz'
67
- php: |
68
- array('foo#bar' => 'baz')
69
- ---
70
- test: 'Hash key ending with a space and a #'
71
- brief: >
72
- 'Hash key ending with a space and a #'
73
- yaml: |
74
- 'foo #': baz
75
- php: |
76
- array('foo #' => 'baz')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml DELETED
@@ -1,159 +0,0 @@
1
- --- %YAML:1.0
2
- test: Compact notation
3
- brief: |
4
- Compact notation for sets of mappings with single element
5
- yaml: |
6
- ---
7
- # products purchased
8
- - item : Super Hoop
9
- - item : Basketball
10
- quantity: 1
11
- - item:
12
- name: Big Shoes
13
- nick: Biggies
14
- quantity: 1
15
- php: |
16
- array (
17
- array (
18
- 'item' => 'Super Hoop',
19
- ),
20
- array (
21
- 'item' => 'Basketball',
22
- 'quantity' => 1,
23
- ),
24
- array (
25
- 'item' => array(
26
- 'name' => 'Big Shoes',
27
- 'nick' => 'Biggies'
28
- ),
29
- 'quantity' => 1
30
- )
31
- )
32
- ---
33
- test: Compact notation combined with inline notation
34
- brief: |
35
- Combinations of compact and inline notation are allowed
36
- yaml: |
37
- ---
38
- items:
39
- - { item: Super Hoop, quantity: 1 }
40
- - [ Basketball, Big Shoes ]
41
- php: |
42
- array (
43
- 'items' => array (
44
- array (
45
- 'item' => 'Super Hoop',
46
- 'quantity' => 1,
47
- ),
48
- array (
49
- 'Basketball',
50
- 'Big Shoes'
51
- )
52
- )
53
- )
54
- --- %YAML:1.0
55
- test: Compact notation
56
- brief: |
57
- Compact notation for sets of mappings with single element
58
- yaml: |
59
- ---
60
- # products purchased
61
- - item : Super Hoop
62
- - item : Basketball
63
- quantity: 1
64
- - item:
65
- name: Big Shoes
66
- nick: Biggies
67
- quantity: 1
68
- php: |
69
- array (
70
- array (
71
- 'item' => 'Super Hoop',
72
- ),
73
- array (
74
- 'item' => 'Basketball',
75
- 'quantity' => 1,
76
- ),
77
- array (
78
- 'item' => array(
79
- 'name' => 'Big Shoes',
80
- 'nick' => 'Biggies'
81
- ),
82
- 'quantity' => 1
83
- )
84
- )
85
- ---
86
- test: Compact notation combined with inline notation
87
- brief: |
88
- Combinations of compact and inline notation are allowed
89
- yaml: |
90
- ---
91
- items:
92
- - { item: Super Hoop, quantity: 1 }
93
- - [ Basketball, Big Shoes ]
94
- php: |
95
- array (
96
- 'items' => array (
97
- array (
98
- 'item' => 'Super Hoop',
99
- 'quantity' => 1,
100
- ),
101
- array (
102
- 'Basketball',
103
- 'Big Shoes'
104
- )
105
- )
106
- )
107
- --- %YAML:1.0
108
- test: Compact notation
109
- brief: |
110
- Compact notation for sets of mappings with single element
111
- yaml: |
112
- ---
113
- # products purchased
114
- - item : Super Hoop
115
- - item : Basketball
116
- quantity: 1
117
- - item:
118
- name: Big Shoes
119
- nick: Biggies
120
- quantity: 1
121
- php: |
122
- array (
123
- array (
124
- 'item' => 'Super Hoop',
125
- ),
126
- array (
127
- 'item' => 'Basketball',
128
- 'quantity' => 1,
129
- ),
130
- array (
131
- 'item' => array(
132
- 'name' => 'Big Shoes',
133
- 'nick' => 'Biggies'
134
- ),
135
- 'quantity' => 1
136
- )
137
- )
138
- ---
139
- test: Compact notation combined with inline notation
140
- brief: |
141
- Combinations of compact and inline notation are allowed
142
- yaml: |
143
- ---
144
- items:
145
- - { item: Super Hoop, quantity: 1 }
146
- - [ Basketball, Big Shoes ]
147
- php: |
148
- array (
149
- 'items' => array (
150
- array (
151
- 'item' => 'Super Hoop',
152
- 'quantity' => 1,
153
- ),
154
- array (
155
- 'Basketball',
156
- 'Big Shoes'
157
- )
158
- )
159
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml DELETED
@@ -1,66 +0,0 @@
1
- --- %YAML:1.0
2
- test: Simple In Place Substitution
3
- brief: >
4
- If you want to reuse an entire alias, only overwriting what is different
5
- you can use a << in place substitution. This is not part of the official
6
- YAML spec, but a widely implemented extension. See the following URL for
7
- details: http://yaml.org/type/merge.html
8
- yaml: |
9
- foo: &foo
10
- a: Steve
11
- b: Clark
12
- c: Brian
13
- e: notnull
14
- bar:
15
- a: before
16
- d: other
17
- e: ~
18
- <<: *foo
19
- b: new
20
- x: Oren
21
- c:
22
- foo: bar
23
- foo: ignore
24
- bar: foo
25
- bar_inline: {a: before, d: other, <<: *foo, b: new, x: Oren, c: { foo: bar, foo: ignore, bar: foo}}
26
- duplicate:
27
- foo: bar
28
- foo: ignore
29
- foo2: &foo2
30
- a: Ballmer
31
- ding: &dong [ fi, fei, fo, fam]
32
- check:
33
- <<:
34
- - *foo
35
- - *dong
36
- isit: tested
37
- head:
38
- <<: [ *foo , *dong , *foo2 ]
39
- taz: &taz
40
- a: Steve
41
- w:
42
- p: 1234
43
- nested:
44
- <<: *taz
45
- d: Doug
46
- w: &nestedref
47
- p: 12345
48
- z:
49
- <<: *nestedref
50
- head_inline: &head_inline { <<: [ *foo , *dong , *foo2 ] }
51
- recursive_inline: { <<: *head_inline, c: { <<: *foo2 } }
52
- php: |
53
- array(
54
- 'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'),
55
- 'bar' => array('a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'),
56
- 'bar_inline' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'e' => 'notnull', 'x' => 'Oren'),
57
- 'duplicate' => array('foo' => 'bar'),
58
- 'foo2' => array('a' => 'Ballmer'),
59
- 'ding' => array('fi', 'fei', 'fo', 'fam'),
60
- 'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'),
61
- 'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
62
- 'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)),
63
- 'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345)),
64
- 'head_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
65
- 'recursive_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => array('a' => 'Ballmer'), 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
66
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml DELETED
@@ -1,11 +0,0 @@
1
- --- %YAML:1.0
2
- test: Objects
3
- brief: >
4
- Comments at the end of a line
5
- yaml: |
6
- ex1: "foo # bar"
7
- ex2: "foo # bar" # comment
8
- ex3: 'foo # bar' # comment
9
- ex4: foo # comment
10
- php: |
11
- array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo')
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml DELETED
@@ -1,33 +0,0 @@
1
- --- %YAML:1.0
2
- test: Some characters at the beginning of a string must be escaped
3
- brief: >
4
- Some characters at the beginning of a string must be escaped
5
- yaml: |
6
- foo: '| bar'
7
- php: |
8
- array('foo' => '| bar')
9
- ---
10
- test: A key can be a quoted string
11
- brief: >
12
- A key can be a quoted string
13
- yaml: |
14
- "foo1": bar
15
- 'foo2': bar
16
- "foo \" bar": bar
17
- 'foo '' bar': bar
18
- 'foo3: ': bar
19
- "foo4: ": bar
20
- foo5: { "foo \" bar: ": bar, 'foo '' bar: ': bar }
21
- php: |
22
- array(
23
- 'foo1' => 'bar',
24
- 'foo2' => 'bar',
25
- 'foo " bar' => 'bar',
26
- 'foo \' bar' => 'bar',
27
- 'foo3: ' => 'bar',
28
- 'foo4: ' => 'bar',
29
- 'foo5' => array(
30
- 'foo " bar: ' => 'bar',
31
- 'foo \' bar: ' => 'bar',
32
- ),
33
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/sfTests.yml DELETED
@@ -1,149 +0,0 @@
1
- --- %YAML:1.0
2
- test: Multiple quoted string on one line
3
- brief: >
4
- Multiple quoted string on one line
5
- yaml: |
6
- stripped_title: { name: "foo bar", help: "bar foo" }
7
- php: |
8
- array('stripped_title' => array('name' => 'foo bar', 'help' => 'bar foo'))
9
- ---
10
- test: Empty sequence
11
- yaml: |
12
- foo: [ ]
13
- php: |
14
- array('foo' => array())
15
- ---
16
- test: Empty value
17
- yaml: |
18
- foo:
19
- php: |
20
- array('foo' => null)
21
- ---
22
- test: Inline string parsing
23
- brief: >
24
- Inline string parsing
25
- yaml: |
26
- test: ['complex: string', 'another [string]']
27
- php: |
28
- array('test' => array('complex: string', 'another [string]'))
29
- ---
30
- test: Boolean
31
- brief: >
32
- Boolean
33
- yaml: |
34
- - false
35
- - true
36
- - null
37
- - ~
38
- - 'false'
39
- - 'true'
40
- - 'null'
41
- - '~'
42
- php: |
43
- array(
44
- false,
45
- true,
46
- null,
47
- null,
48
- 'false',
49
- 'true',
50
- 'null',
51
- '~',
52
- )
53
- ---
54
- test: Empty lines in literal blocks
55
- brief: >
56
- Empty lines in literal blocks
57
- yaml: |
58
- foo:
59
- bar: |
60
- foo
61
-
62
-
63
-
64
- bar
65
- php: |
66
- array('foo' => array('bar' => "foo\n\n\n \nbar\n"))
67
- ---
68
- test: Empty lines in folded blocks
69
- brief: >
70
- Empty lines in folded blocks
71
- yaml: |
72
- foo:
73
- bar: >
74
-
75
- foo
76
-
77
-
78
- bar
79
- php: |
80
- array('foo' => array('bar' => "\nfoo\n\nbar\n"))
81
- ---
82
- test: IP addresses
83
- brief: >
84
- IP addresses
85
- yaml: |
86
- foo: 10.0.0.2
87
- php: |
88
- array('foo' => '10.0.0.2')
89
- ---
90
- test: A sequence with an embedded mapping
91
- brief: >
92
- A sequence with an embedded mapping
93
- yaml: |
94
- - foo
95
- - bar: { bar: foo }
96
- php: |
97
- array('foo', array('bar' => array('bar' => 'foo')))
98
- ---
99
- test: A sequence with an unordered array
100
- brief: >
101
- A sequence with an unordered array
102
- yaml: |
103
- 1: foo
104
- 0: bar
105
- php: |
106
- array(1 => 'foo', 0 => 'bar')
107
- ---
108
- test: Octal
109
- brief: as in spec example 2.19, octal value is converted
110
- yaml: |
111
- foo: 0123
112
- php: |
113
- array('foo' => 83)
114
- ---
115
- test: Octal strings
116
- brief: Octal notation in a string must remain a string
117
- yaml: |
118
- foo: "0123"
119
- php: |
120
- array('foo' => '0123')
121
- ---
122
- test: Octal strings
123
- brief: Octal notation in a string must remain a string
124
- yaml: |
125
- foo: '0123'
126
- php: |
127
- array('foo' => '0123')
128
- ---
129
- test: Octal strings
130
- brief: Octal notation in a string must remain a string
131
- yaml: |
132
- foo: |
133
- 0123
134
- php: |
135
- array('foo' => "0123\n")
136
- ---
137
- test: Document as a simple hash
138
- brief: Document as a simple hash
139
- yaml: |
140
- { foo: bar }
141
- php: |
142
- array('foo' => 'bar')
143
- ---
144
- test: Document as a simple array
145
- brief: Document as a simple array
146
- yaml: |
147
- [ foo, bar ]
148
- php: |
149
- array('foo', 'bar')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml DELETED
@@ -1,82 +0,0 @@
1
- --- %YAML:1.0
2
- test: Unindented collection
3
- brief: >
4
- Unindented collection
5
- yaml: |
6
- collection:
7
- - item1
8
- - item2
9
- - item3
10
- php: |
11
- array('collection' => array('item1', 'item2', 'item3'))
12
- ---
13
- test: Nested unindented collection (two levels)
14
- brief: >
15
- Nested unindented collection
16
- yaml: |
17
- collection:
18
- key:
19
- - a
20
- - b
21
- - c
22
- php: |
23
- array('collection' => array('key' => array('a', 'b', 'c')))
24
- ---
25
- test: Nested unindented collection (three levels)
26
- brief: >
27
- Nested unindented collection
28
- yaml: |
29
- collection:
30
- key:
31
- subkey:
32
- - one
33
- - two
34
- - three
35
- php: |
36
- array('collection' => array('key' => array('subkey' => array('one', 'two', 'three'))))
37
- ---
38
- test: Key/value after unindented collection (1)
39
- brief: >
40
- Key/value after unindented collection (1)
41
- yaml: |
42
- collection:
43
- key:
44
- - a
45
- - b
46
- - c
47
- foo: bar
48
- php: |
49
- array('collection' => array('key' => array('a', 'b', 'c')), 'foo' => 'bar')
50
- ---
51
- test: Key/value after unindented collection (at the same level)
52
- brief: >
53
- Key/value after unindented collection
54
- yaml: |
55
- collection:
56
- key:
57
- - a
58
- - b
59
- - c
60
- foo: bar
61
- php: |
62
- array('collection' => array('key' => array('a', 'b', 'c'), 'foo' => 'bar'))
63
- ---
64
- test: Shortcut Key after unindented collection
65
- brief: >
66
- Key/value after unindented collection
67
- yaml: |
68
- collection:
69
- - key: foo
70
- foo: bar
71
- php: |
72
- array('collection' => array(array('key' => 'foo', 'foo' => 'bar')))
73
- ---
74
- test: Shortcut Key after unindented collection with custom spaces
75
- brief: >
76
- Key/value after unindented collection
77
- yaml: |
78
- collection:
79
- - key: foo
80
- foo: bar
81
- php: |
82
- array('collection' => array(array('key' => 'foo', 'foo' => 'bar')))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/InlineTest.php DELETED
@@ -1,506 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Tests;
13
-
14
- use PHPUnit\Framework\TestCase;
15
- use Symfony\Component\Yaml\Inline;
16
-
17
- class InlineTest extends TestCase
18
- {
19
- /**
20
- * @dataProvider getTestsForParse
21
- */
22
- public function testParse($yaml, $value)
23
- {
24
- $this->assertSame($value, Inline::parse($yaml), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml));
25
- }
26
-
27
- /**
28
- * @dataProvider getTestsForParseWithMapObjects
29
- */
30
- public function testParseWithMapObjects($yaml, $value)
31
- {
32
- $actual = Inline::parse($yaml, false, false, true);
33
-
34
- $this->assertSame(serialize($value), serialize($actual));
35
- }
36
-
37
- /**
38
- * @dataProvider getTestsForDump
39
- */
40
- public function testDump($yaml, $value)
41
- {
42
- $this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
43
-
44
- $this->assertSame($value, Inline::parse(Inline::dump($value)), 'check consistency');
45
- }
46
-
47
- public function testDumpNumericValueWithLocale()
48
- {
49
- $locale = setlocale(LC_NUMERIC, 0);
50
- if (false === $locale) {
51
- $this->markTestSkipped('Your platform does not support locales.');
52
- }
53
-
54
- try {
55
- $requiredLocales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
56
- if (false === setlocale(LC_NUMERIC, $requiredLocales)) {
57
- $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $requiredLocales));
58
- }
59
-
60
- $this->assertEquals('1.2', Inline::dump(1.2));
61
- $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0)));
62
- setlocale(LC_NUMERIC, $locale);
63
- } catch (\Exception $e) {
64
- setlocale(LC_NUMERIC, $locale);
65
- throw $e;
66
- }
67
- }
68
-
69
- public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedToINF()
70
- {
71
- $value = '686e444';
72
-
73
- $this->assertSame($value, Inline::parse(Inline::dump($value)));
74
- }
75
-
76
- /**
77
- * @group legacy
78
- * throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
79
- */
80
- public function testParseScalarWithNonEscapedBlackslashShouldThrowException()
81
- {
82
- $this->assertSame('Foo\Var', Inline::parse('"Foo\Var"'));
83
- }
84
-
85
- /**
86
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
87
- */
88
- public function testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException()
89
- {
90
- Inline::parse('"Foo\\"');
91
- }
92
-
93
- /**
94
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
95
- */
96
- public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException()
97
- {
98
- $value = "'don't do somthin' like that'";
99
- Inline::parse($value);
100
- }
101
-
102
- /**
103
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
104
- */
105
- public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException()
106
- {
107
- $value = '"don"t do somthin" like that"';
108
- Inline::parse($value);
109
- }
110
-
111
- /**
112
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
113
- */
114
- public function testParseInvalidMappingKeyShouldThrowException()
115
- {
116
- $value = '{ "foo " bar": "bar" }';
117
- Inline::parse($value);
118
- }
119
-
120
- /**
121
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
122
- */
123
- public function testParseInvalidMappingShouldThrowException()
124
- {
125
- Inline::parse('[foo] bar');
126
- }
127
-
128
- /**
129
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
130
- */
131
- public function testParseInvalidSequenceShouldThrowException()
132
- {
133
- Inline::parse('{ foo: bar } bar');
134
- }
135
-
136
- public function testParseScalarWithCorrectlyQuotedStringShouldReturnString()
137
- {
138
- $value = "'don''t do somthin'' like that'";
139
- $expect = "don't do somthin' like that";
140
-
141
- $this->assertSame($expect, Inline::parseScalar($value));
142
- }
143
-
144
- /**
145
- * @dataProvider getDataForParseReferences
146
- */
147
- public function testParseReferences($yaml, $expected)
148
- {
149
- $this->assertSame($expected, Inline::parse($yaml, false, false, false, array('var' => 'var-value')));
150
- }
151
-
152
- public function getDataForParseReferences()
153
- {
154
- return array(
155
- 'scalar' => array('*var', 'var-value'),
156
- 'list' => array('[ *var ]', array('var-value')),
157
- 'list-in-list' => array('[[ *var ]]', array(array('var-value'))),
158
- 'map-in-list' => array('[ { key: *var } ]', array(array('key' => 'var-value'))),
159
- 'embedded-mapping-in-list' => array('[ key: *var ]', array(array('key' => 'var-value'))),
160
- 'map' => array('{ key: *var }', array('key' => 'var-value')),
161
- 'list-in-map' => array('{ key: [*var] }', array('key' => array('var-value'))),
162
- 'map-in-map' => array('{ foo: { bar: *var } }', array('foo' => array('bar' => 'var-value'))),
163
- );
164
- }
165
-
166
- public function testParseMapReferenceInSequence()
167
- {
168
- $foo = array(
169
- 'a' => 'Steve',
170
- 'b' => 'Clark',
171
- 'c' => 'Brian',
172
- );
173
- $this->assertSame(array($foo), Inline::parse('[*foo]', false, false, false, array('foo' => $foo)));
174
- }
175
-
176
- /**
177
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
178
- * @expectedExceptionMessage A reference must contain at least one character.
179
- */
180
- public function testParseUnquotedAsterisk()
181
- {
182
- Inline::parse('{ foo: * }');
183
- }
184
-
185
- /**
186
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
187
- * @expectedExceptionMessage A reference must contain at least one character.
188
- */
189
- public function testParseUnquotedAsteriskFollowedByAComment()
190
- {
191
- Inline::parse('{ foo: * #foo }');
192
- }
193
-
194
- /**
195
- * @group legacy
196
- * @expectedDeprecation Not quoting the scalar "@foo " starting with "@" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.
197
- * throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
198
- */
199
- public function testParseUnquotedScalarStartingWithReservedAtIndicator()
200
- {
201
- Inline::parse('{ foo: @foo }');
202
- }
203
-
204
- /**
205
- * @group legacy
206
- * @expectedDeprecation Not quoting the scalar "`foo " starting with "`" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.
207
- * throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
208
- */
209
- public function testParseUnquotedScalarStartingWithReservedBacktickIndicator()
210
- {
211
- Inline::parse('{ foo: `foo }');
212
- }
213
-
214
- /**
215
- * @group legacy
216
- * @expectedDeprecation Not quoting the scalar "|foo " starting with "|" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.
217
- * throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
218
- */
219
- public function testParseUnquotedScalarStartingWithLiteralStyleIndicator()
220
- {
221
- Inline::parse('{ foo: |foo }');
222
- }
223
-
224
- /**
225
- * @group legacy
226
- * @expectedDeprecation Not quoting the scalar ">foo " starting with ">" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.
227
- * throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
228
- */
229
- public function testParseUnquotedScalarStartingWithFoldedStyleIndicator()
230
- {
231
- Inline::parse('{ foo: >foo }');
232
- }
233
-
234
- public function getScalarIndicators()
235
- {
236
- return array(array('|'), array('>'));
237
- }
238
-
239
- /**
240
- * @dataProvider getDataForIsHash
241
- */
242
- public function testIsHash($array, $expected)
243
- {
244
- $this->assertSame($expected, Inline::isHash($array));
245
- }
246
-
247
- public function getDataForIsHash()
248
- {
249
- return array(
250
- array(array(), false),
251
- array(array(1, 2, 3), false),
252
- array(array(2 => 1, 1 => 2, 0 => 3), true),
253
- array(array('foo' => 1, 'bar' => 2), true),
254
- );
255
- }
256
-
257
- public function getTestsForParse()
258
- {
259
- return array(
260
- array('', ''),
261
- array('null', null),
262
- array('false', false),
263
- array('true', true),
264
- array('12', 12),
265
- array('-12', -12),
266
- array('"quoted string"', 'quoted string'),
267
- array("'quoted string'", 'quoted string'),
268
- array('12.30e+02', 12.30e+02),
269
- array('0x4D2', 0x4D2),
270
- array('02333', 02333),
271
- array('.Inf', -log(0)),
272
- array('-.Inf', log(0)),
273
- array("'686e444'", '686e444'),
274
- array('686e444', 646e444),
275
- array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
276
- array('"foo\r\nbar"', "foo\r\nbar"),
277
- array("'foo#bar'", 'foo#bar'),
278
- array("'foo # bar'", 'foo # bar'),
279
- array("'#cfcfcf'", '#cfcfcf'),
280
- array('::form_base.html.twig', '::form_base.html.twig'),
281
-
282
- // Pre-YAML-1.2 booleans
283
- array("'y'", 'y'),
284
- array("'n'", 'n'),
285
- array("'yes'", 'yes'),
286
- array("'no'", 'no'),
287
- array("'on'", 'on'),
288
- array("'off'", 'off'),
289
-
290
- array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
291
- array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
292
- array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
293
- array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
294
- array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
295
-
296
- array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
297
- array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
298
-
299
- // sequences
300
- // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
301
- array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
302
- array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),
303
- array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
304
-
305
- // mappings
306
- array('{foo:bar,bar:foo,false:false,null:null,integer:12}', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
307
- array('{ foo : bar, bar : foo, false : false, null : null, integer : 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
308
- array('{foo: \'bar\', bar: \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
309
- array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
310
- array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
311
- array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
312
-
313
- // nested sequences and mappings
314
- array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
315
- array('[foo, {bar: foo}]', array('foo', array('bar' => 'foo'))),
316
- array('{ foo: {bar: foo} }', array('foo' => array('bar' => 'foo'))),
317
- array('{ foo: [bar, foo] }', array('foo' => array('bar', 'foo'))),
318
-
319
- array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),
320
-
321
- array('[{ foo: {bar: foo} }]', array(array('foo' => array('bar' => 'foo')))),
322
-
323
- array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
324
-
325
- array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
326
-
327
- array('[foo, bar: { foo: bar }]', array('foo', '1' => array('bar' => array('foo' => 'bar')))),
328
- array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
329
- );
330
- }
331
-
332
- public function getTestsForParseWithMapObjects()
333
- {
334
- return array(
335
- array('', ''),
336
- array('null', null),
337
- array('false', false),
338
- array('true', true),
339
- array('12', 12),
340
- array('-12', -12),
341
- array('"quoted string"', 'quoted string'),
342
- array("'quoted string'", 'quoted string'),
343
- array('12.30e+02', 12.30e+02),
344
- array('0x4D2', 0x4D2),
345
- array('02333', 02333),
346
- array('.Inf', -log(0)),
347
- array('-.Inf', log(0)),
348
- array("'686e444'", '686e444'),
349
- array('686e444', 646e444),
350
- array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
351
- array('"foo\r\nbar"', "foo\r\nbar"),
352
- array("'foo#bar'", 'foo#bar'),
353
- array("'foo # bar'", 'foo # bar'),
354
- array("'#cfcfcf'", '#cfcfcf'),
355
- array('::form_base.html.twig', '::form_base.html.twig'),
356
-
357
- array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
358
- array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
359
- array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
360
- array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
361
- array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
362
-
363
- array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
364
- array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
365
-
366
- // sequences
367
- // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
368
- array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
369
- array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),
370
- array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
371
-
372
- // mappings
373
- array('{foo:bar,bar:foo,false:false,null:null,integer:12}', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
374
- array('{ foo : bar, bar : foo, false : false, null : null, integer : 12 }', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
375
- array('{foo: \'bar\', bar: \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
376
- array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
377
- array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
378
- array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
379
-
380
- // nested sequences and mappings
381
- array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
382
- array('[foo, {bar: foo}]', array('foo', (object) array('bar' => 'foo'))),
383
- array('{ foo: {bar: foo} }', (object) array('foo' => (object) array('bar' => 'foo'))),
384
- array('{ foo: [bar, foo] }', (object) array('foo' => array('bar', 'foo'))),
385
-
386
- array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),
387
-
388
- array('[{ foo: {bar: foo} }]', array((object) array('foo' => (object) array('bar' => 'foo')))),
389
-
390
- array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
391
-
392
- array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', (object) array('bar' => 'foo', 'foo' => array('foo', (object) array('bar' => 'foo'))), array('foo', (object) array('bar' => 'foo')))),
393
-
394
- array('[foo, bar: { foo: bar }]', array('foo', '1' => (object) array('bar' => (object) array('foo' => 'bar')))),
395
- array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', (object) array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
396
-
397
- array('{}', new \stdClass()),
398
- array('{ foo : bar, bar : {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
399
- array('{ foo : [], bar : {} }', (object) array('foo' => array(), 'bar' => new \stdClass())),
400
- array('{foo: \'bar\', bar: {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
401
- array('{\'foo\': \'bar\', "bar": {}}', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
402
- array('{\'foo\': \'bar\', "bar": \'{}\'}', (object) array('foo' => 'bar', 'bar' => '{}')),
403
-
404
- array('[foo, [{}, {}]]', array('foo', array(new \stdClass(), new \stdClass()))),
405
- array('[foo, [[], {}]]', array('foo', array(array(), new \stdClass()))),
406
- array('[foo, [[{}, {}], {}]]', array('foo', array(array(new \stdClass(), new \stdClass()), new \stdClass()))),
407
- array('[foo, {bar: {}}]', array('foo', '1' => (object) array('bar' => new \stdClass()))),
408
- );
409
- }
410
-
411
- public function getTestsForDump()
412
- {
413
- return array(
414
- array('null', null),
415
- array('false', false),
416
- array('true', true),
417
- array('12', 12),
418
- array("'quoted string'", 'quoted string'),
419
- array('!!float 1230', 12.30e+02),
420
- array('1234', 0x4D2),
421
- array('1243', 02333),
422
- array('.Inf', -log(0)),
423
- array('-.Inf', log(0)),
424
- array("'686e444'", '686e444'),
425
- array('"foo\r\nbar"', "foo\r\nbar"),
426
- array("'foo#bar'", 'foo#bar'),
427
- array("'foo # bar'", 'foo # bar'),
428
- array("'#cfcfcf'", '#cfcfcf'),
429
-
430
- array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
431
-
432
- array("'-dash'", '-dash'),
433
- array("'-'", '-'),
434
-
435
- // Pre-YAML-1.2 booleans
436
- array("'y'", 'y'),
437
- array("'n'", 'n'),
438
- array("'yes'", 'yes'),
439
- array("'no'", 'no'),
440
- array("'on'", 'on'),
441
- array("'off'", 'off'),
442
-
443
- // sequences
444
- array('[foo, bar, false, null, 12]', array('foo', 'bar', false, null, 12)),
445
- array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
446
-
447
- // mappings
448
- array('{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
449
- array('{ foo: bar, bar: \'foo: bar\' }', array('foo' => 'bar', 'bar' => 'foo: bar')),
450
-
451
- // nested sequences and mappings
452
- array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
453
-
454
- array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
455
-
456
- array('{ foo: { bar: foo } }', array('foo' => array('bar' => 'foo'))),
457
-
458
- array('[foo, { bar: foo }]', array('foo', array('bar' => 'foo'))),
459
-
460
- array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
461
-
462
- array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
463
-
464
- array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),
465
- );
466
- }
467
-
468
- /**
469
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
470
- * @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported}.
471
- */
472
- public function testNotSupportedMissingValue()
473
- {
474
- Inline::parse('{this, is not, supported}');
475
- }
476
-
477
- public function testVeryLongQuotedStrings()
478
- {
479
- $longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000);
480
-
481
- $yamlString = Inline::dump(array('longStringWithQuotes' => $longStringWithQuotes));
482
- $arrayFromYaml = Inline::parse($yamlString);
483
-
484
- $this->assertEquals($longStringWithQuotes, $arrayFromYaml['longStringWithQuotes']);
485
- }
486
-
487
- public function testBooleanMappingKeysAreConvertedToStrings()
488
- {
489
- $this->assertSame(array('false' => 'foo'), Inline::parse('{false: foo}'));
490
- $this->assertSame(array('true' => 'foo'), Inline::parse('{true: foo}'));
491
- }
492
-
493
- public function testTheEmptyStringIsAValidMappingKey()
494
- {
495
- $this->assertSame(array('' => 'foo'), Inline::parse('{ "": foo }'));
496
- }
497
-
498
- /**
499
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
500
- * @expectedExceptionMessage Unexpected end of line, expected one of ",}".
501
- */
502
- public function testUnfinishedInlineMap()
503
- {
504
- Inline::parse("{abc: 'def'");
505
- }
506
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/ParseExceptionTest.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Tests;
13
-
14
- use PHPUnit\Framework\TestCase;
15
- use Symfony\Component\Yaml\Exception\ParseException;
16
-
17
- class ParseExceptionTest extends TestCase
18
- {
19
- public function testGetMessage()
20
- {
21
- $exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml');
22
- if (\PHP_VERSION_ID >= 50400) {
23
- $message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")';
24
- } else {
25
- $message = 'Error message in "\\/var\\/www\\/app\\/config.yml" at line 42 (near "foo: bar")';
26
- }
27
-
28
- $this->assertEquals($message, $exception->getMessage());
29
- }
30
-
31
- public function testGetMessageWithUnicodeInFilename()
32
- {
33
- $exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml');
34
- if (\PHP_VERSION_ID >= 50400) {
35
- $message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")';
36
- } else {
37
- $message = 'Error message in "\u00e4\u00f6\u00fc.yml" at line 42 (near "foo: bar")';
38
- }
39
-
40
- $this->assertEquals($message, $exception->getMessage());
41
- }
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/ParserTest.php DELETED
@@ -1,1300 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Tests;
13
-
14
- use PHPUnit\Framework\TestCase;
15
- use Symfony\Component\Yaml\Parser;
16
- use Symfony\Component\Yaml\Yaml;
17
-
18
- class ParserTest extends TestCase
19
- {
20
- /** @var Parser */
21
- protected $parser;
22
-
23
- protected function setUp()
24
- {
25
- $this->parser = new Parser();
26
- }
27
-
28
- protected function tearDown()
29
- {
30
- $this->parser = null;
31
- }
32
-
33
- /**
34
- * @dataProvider getDataFormSpecifications
35
- */
36
- public function testSpecifications($file, $expected, $yaml, $comment)
37
- {
38
- $this->assertEquals($expected, var_export($this->parser->parse($yaml), true), $comment);
39
- }
40
-
41
- public function getDataFormSpecifications()
42
- {
43
- $parser = new Parser();
44
- $path = __DIR__.'/Fixtures';
45
-
46
- $tests = array();
47
- $files = $parser->parse(file_get_contents($path.'/index.yml'));
48
- foreach ($files as $file) {
49
- $yamls = file_get_contents($path.'/'.$file.'.yml');
50
-
51
- // split YAMLs documents
52
- foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) {
53
- if (!$yaml) {
54
- continue;
55
- }
56
-
57
- $test = $parser->parse($yaml);
58
- if (isset($test['todo']) && $test['todo']) {
59
- // TODO
60
- } else {
61
- eval('$expected = '.trim($test['php']).';');
62
-
63
- $tests[] = array($file, var_export($expected, true), $test['yaml'], $test['test']);
64
- }
65
- }
66
- }
67
-
68
- return $tests;
69
- }
70
-
71
- public function testTabsInYaml()
72
- {
73
- // test tabs in YAML
74
- $yamls = array(
75
- "foo:\n bar",
76
- "foo:\n bar",
77
- "foo:\n bar",
78
- "foo:\n bar",
79
- );
80
-
81
- foreach ($yamls as $yaml) {
82
- try {
83
- $content = $this->parser->parse($yaml);
84
-
85
- $this->fail('YAML files must not contain tabs');
86
- } catch (\Exception $e) {
87
- $this->assertInstanceOf('\Exception', $e, 'YAML files must not contain tabs');
88
- $this->assertEquals('A YAML file cannot contain tabs as indentation at line 2 (near "'.strpbrk($yaml, "\t").'").', $e->getMessage(), 'YAML files must not contain tabs');
89
- }
90
- }
91
- }
92
-
93
- public function testEndOfTheDocumentMarker()
94
- {
95
- $yaml = <<<'EOF'
96
- --- %YAML:1.0
97
- foo
98
- ...
99
- EOF;
100
-
101
- $this->assertEquals('foo', $this->parser->parse($yaml));
102
- }
103
-
104
- public function getBlockChompingTests()
105
- {
106
- $tests = array();
107
-
108
- $yaml = <<<'EOF'
109
- foo: |-
110
- one
111
- two
112
- bar: |-
113
- one
114
- two
115
-
116
- EOF;
117
- $expected = array(
118
- 'foo' => "one\ntwo",
119
- 'bar' => "one\ntwo",
120
- );
121
- $tests['Literal block chomping strip with single trailing newline'] = array($expected, $yaml);
122
-
123
- $yaml = <<<'EOF'
124
- foo: |-
125
- one
126
- two
127
-
128
- bar: |-
129
- one
130
- two
131
-
132
-
133
- EOF;
134
- $expected = array(
135
- 'foo' => "one\ntwo",
136
- 'bar' => "one\ntwo",
137
- );
138
- $tests['Literal block chomping strip with multiple trailing newlines'] = array($expected, $yaml);
139
-
140
- $yaml = <<<'EOF'
141
- {}
142
-
143
-
144
- EOF;
145
- $expected = array();
146
- $tests['Literal block chomping strip with multiple trailing newlines after a 1-liner'] = array($expected, $yaml);
147
-
148
- $yaml = <<<'EOF'
149
- foo: |-
150
- one
151
- two
152
- bar: |-
153
- one
154
- two
155
- EOF;
156
- $expected = array(
157
- 'foo' => "one\ntwo",
158
- 'bar' => "one\ntwo",
159
- );
160
- $tests['Literal block chomping strip without trailing newline'] = array($expected, $yaml);
161
-
162
- $yaml = <<<'EOF'
163
- foo: |
164
- one
165
- two
166
- bar: |
167
- one
168
- two
169
-
170
- EOF;
171
- $expected = array(
172
- 'foo' => "one\ntwo\n",
173
- 'bar' => "one\ntwo\n",
174
- );
175
- $tests['Literal block chomping clip with single trailing newline'] = array($expected, $yaml);
176
-
177
- $yaml = <<<'EOF'
178
- foo: |
179
- one
180
- two
181
-
182
- bar: |
183
- one
184
- two
185
-
186
-
187
- EOF;
188
- $expected = array(
189
- 'foo' => "one\ntwo\n",
190
- 'bar' => "one\ntwo\n",
191
- );
192
- $tests['Literal block chomping clip with multiple trailing newlines'] = array($expected, $yaml);
193
-
194
- $yaml = <<<'EOF'
195
- foo:
196
- - bar: |
197
- one
198
-
199
- two
200
- EOF;
201
- $expected = array(
202
- 'foo' => array(
203
- array(
204
- 'bar' => "one\n\ntwo",
205
- ),
206
- ),
207
- );
208
- $tests['Literal block chomping clip with embedded blank line inside unindented collection'] = array($expected, $yaml);
209
-
210
- $yaml = <<<'EOF'
211
- foo: |
212
- one
213
- two
214
- bar: |
215
- one
216
- two
217
- EOF;
218
- $expected = array(
219
- 'foo' => "one\ntwo\n",
220
- 'bar' => "one\ntwo",
221
- );
222
- $tests['Literal block chomping clip without trailing newline'] = array($expected, $yaml);
223
-
224
- $yaml = <<<'EOF'
225
- foo: |+
226
- one
227
- two
228
- bar: |+
229
- one
230
- two
231
-
232
- EOF;
233
- $expected = array(
234
- 'foo' => "one\ntwo\n",
235
- 'bar' => "one\ntwo\n",
236
- );
237
- $tests['Literal block chomping keep with single trailing newline'] = array($expected, $yaml);
238
-
239
- $yaml = <<<'EOF'
240
- foo: |+
241
- one
242
- two
243
-
244
- bar: |+
245
- one
246
- two
247
-
248
-
249
- EOF;
250
- $expected = array(
251
- 'foo' => "one\ntwo\n\n",
252
- 'bar' => "one\ntwo\n\n",
253
- );
254
- $tests['Literal block chomping keep with multiple trailing newlines'] = array($expected, $yaml);
255
-
256
- $yaml = <<<'EOF'
257
- foo: |+
258
- one
259
- two
260
- bar: |+
261
- one
262
- two
263
- EOF;
264
- $expected = array(
265
- 'foo' => "one\ntwo\n",
266
- 'bar' => "one\ntwo",
267
- );
268
- $tests['Literal block chomping keep without trailing newline'] = array($expected, $yaml);
269
-
270
- $yaml = <<<'EOF'
271
- foo: >-
272
- one
273
- two
274
- bar: >-
275
- one
276
- two
277
-
278
- EOF;
279
- $expected = array(
280
- 'foo' => 'one two',
281
- 'bar' => 'one two',
282
- );
283
- $tests['Folded block chomping strip with single trailing newline'] = array($expected, $yaml);
284
-
285
- $yaml = <<<'EOF'
286
- foo: >-
287
- one
288
- two
289
-
290
- bar: >-
291
- one
292
- two
293
-
294
-
295
- EOF;
296
- $expected = array(
297
- 'foo' => 'one two',
298
- 'bar' => 'one two',
299
- );
300
- $tests['Folded block chomping strip with multiple trailing newlines'] = array($expected, $yaml);
301
-
302
- $yaml = <<<'EOF'
303
- foo: >-
304
- one
305
- two
306
- bar: >-
307
- one
308
- two
309
- EOF;
310
- $expected = array(
311
- 'foo' => 'one two',
312
- 'bar' => 'one two',
313
- );
314
- $tests['Folded block chomping strip without trailing newline'] = array($expected, $yaml);
315
-
316
- $yaml = <<<'EOF'
317
- foo: >
318
- one
319
- two
320
- bar: >
321
- one
322
- two
323
-
324
- EOF;
325
- $expected = array(
326
- 'foo' => "one two\n",
327
- 'bar' => "one two\n",
328
- );
329
- $tests['Folded block chomping clip with single trailing newline'] = array($expected, $yaml);
330
-
331
- $yaml = <<<'EOF'
332
- foo: >
333
- one
334
- two
335
-
336
- bar: >
337
- one
338
- two
339
-
340
-
341
- EOF;
342
- $expected = array(
343
- 'foo' => "one two\n",
344
- 'bar' => "one two\n",
345
- );
346
- $tests['Folded block chomping clip with multiple trailing newlines'] = array($expected, $yaml);
347
-
348
- $yaml = <<<'EOF'
349
- foo: >
350
- one
351
- two
352
- bar: >
353
- one
354
- two
355
- EOF;
356
- $expected = array(
357
- 'foo' => "one two\n",
358
- 'bar' => 'one two',
359
- );
360
- $tests['Folded block chomping clip without trailing newline'] = array($expected, $yaml);
361
-
362
- $yaml = <<<'EOF'
363
- foo: >+
364
- one
365
- two
366
- bar: >+
367
- one
368
- two
369
-
370
- EOF;
371
- $expected = array(
372
- 'foo' => "one two\n",
373
- 'bar' => "one two\n",
374
- );
375
- $tests['Folded block chomping keep with single trailing newline'] = array($expected, $yaml);
376
-
377
- $yaml = <<<'EOF'
378
- foo: >+
379
- one
380
- two
381
-
382
- bar: >+
383
- one
384
- two
385
-
386
-
387
- EOF;
388
- $expected = array(
389
- 'foo' => "one two\n\n",
390
- 'bar' => "one two\n\n",
391
- );
392
- $tests['Folded block chomping keep with multiple trailing newlines'] = array($expected, $yaml);
393
-
394
- $yaml = <<<'EOF'
395
- foo: >+
396
- one
397
- two
398
- bar: >+
399
- one
400
- two
401
- EOF;
402
- $expected = array(
403
- 'foo' => "one two\n",
404
- 'bar' => 'one two',
405
- );
406
- $tests['Folded block chomping keep without trailing newline'] = array($expected, $yaml);
407
-
408
- return $tests;
409
- }
410
-
411
- /**
412
- * @dataProvider getBlockChompingTests
413
- */
414
- public function testBlockChomping($expected, $yaml)
415
- {
416
- $this->assertSame($expected, $this->parser->parse($yaml));
417
- }
418
-
419
- /**
420
- * Regression test for issue #7989.
421
- *
422
- * @see https://github.com/symfony/symfony/issues/7989
423
- */
424
- public function testBlockLiteralWithLeadingNewlines()
425
- {
426
- $yaml = <<<'EOF'
427
- foo: |-
428
-
429
-
430
- bar
431
-
432
- EOF;
433
- $expected = array(
434
- 'foo' => "\n\nbar",
435
- );
436
-
437
- $this->assertSame($expected, $this->parser->parse($yaml));
438
- }
439
-
440
- public function testObjectSupportEnabled()
441
- {
442
- $input = <<<'EOF'
443
- foo: !!php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
444
- bar: 1
445
- EOF;
446
- $this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, false, true), '->parse() is able to parse objects');
447
-
448
- $input = <<<'EOF'
449
- foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
450
- bar: 1
451
- EOF;
452
- $this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, false, true), '->parse() is able to parse objects');
453
- }
454
-
455
- /**
456
- * @dataProvider invalidDumpedObjectProvider
457
- */
458
- public function testObjectSupportDisabledButNoExceptions($input)
459
- {
460
- $this->assertEquals(array('foo' => null, 'bar' => 1), $this->parser->parse($input), '->parse() does not parse objects');
461
- }
462
-
463
- /**
464
- * @dataProvider getObjectForMapTests
465
- */
466
- public function testObjectForMap($yaml, $expected)
467
- {
468
- $this->assertEquals($expected, $this->parser->parse($yaml, false, false, true));
469
- }
470
-
471
- public function getObjectForMapTests()
472
- {
473
- $tests = array();
474
-
475
- $yaml = <<<'EOF'
476
- foo:
477
- fiz: [cat]
478
- EOF;
479
- $expected = new \stdClass();
480
- $expected->foo = new \stdClass();
481
- $expected->foo->fiz = array('cat');
482
- $tests['mapping'] = array($yaml, $expected);
483
-
484
- $yaml = '{ "foo": "bar", "fiz": "cat" }';
485
- $expected = new \stdClass();
486
- $expected->foo = 'bar';
487
- $expected->fiz = 'cat';
488
- $tests['inline-mapping'] = array($yaml, $expected);
489
-
490
- $yaml = "foo: bar\nbaz: foobar";
491
- $expected = new \stdClass();
492
- $expected->foo = 'bar';
493
- $expected->baz = 'foobar';
494
- $tests['object-for-map-is-applied-after-parsing'] = array($yaml, $expected);
495
-
496
- $yaml = <<<'EOT'
497
- array:
498
- - key: one
499
- - key: two
500
- EOT;
501
- $expected = new \stdClass();
502
- $expected->array = array();
503
- $expected->array[0] = new \stdClass();
504
- $expected->array[0]->key = 'one';
505
- $expected->array[1] = new \stdClass();
506
- $expected->array[1]->key = 'two';
507
- $tests['nest-map-and-sequence'] = array($yaml, $expected);
508
-
509
- $yaml = <<<'YAML'
510
- map:
511
- 1: one
512
- 2: two
513
- YAML;
514
- $expected = new \stdClass();
515
- $expected->map = new \stdClass();
516
- $expected->map->{1} = 'one';
517
- $expected->map->{2} = 'two';
518
- $tests['numeric-keys'] = array($yaml, $expected);
519
-
520
- $yaml = <<<'YAML'
521
- map:
522
- 0: one
523
- 1: two
524
- YAML;
525
- $expected = new \stdClass();
526
- $expected->map = new \stdClass();
527
- $expected->map->{0} = 'one';
528
- $expected->map->{1} = 'two';
529
- $tests['zero-indexed-numeric-keys'] = array($yaml, $expected);
530
-
531
- return $tests;
532
- }
533
-
534
- /**
535
- * @dataProvider invalidDumpedObjectProvider
536
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
537
- */
538
- public function testObjectsSupportDisabledWithExceptions($yaml)
539
- {
540
- $this->parser->parse($yaml, true, false);
541
- }
542
-
543
- public function invalidDumpedObjectProvider()
544
- {
545
- $yamlTag = <<<'EOF'
546
- foo: !!php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
547
- bar: 1
548
- EOF;
549
- $localTag = <<<'EOF'
550
- foo: !php/object:O:30:"Symfony\Tests\Component\Yaml\B":1:{s:1:"b";s:3:"foo";}
551
- bar: 1
552
- EOF;
553
-
554
- return array(
555
- 'yaml-tag' => array($yamlTag),
556
- 'local-tag' => array($localTag),
557
- );
558
- }
559
-
560
- /**
561
- * @requires extension iconv
562
- */
563
- public function testNonUtf8Exception()
564
- {
565
- $yamls = array(
566
- iconv('UTF-8', 'ISO-8859-1', "foo: 'äöüß'"),
567
- iconv('UTF-8', 'ISO-8859-15', "euro: '€'"),
568
- iconv('UTF-8', 'CP1252', "cp1252: '©ÉÇáñ'"),
569
- );
570
-
571
- foreach ($yamls as $yaml) {
572
- try {
573
- $this->parser->parse($yaml);
574
-
575
- $this->fail('charsets other than UTF-8 are rejected.');
576
- } catch (\Exception $e) {
577
- $this->assertInstanceOf('Symfony\Component\Yaml\Exception\ParseException', $e, 'charsets other than UTF-8 are rejected.');
578
- }
579
- }
580
- }
581
-
582
- /**
583
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
584
- */
585
- public function testUnindentedCollectionException()
586
- {
587
- $yaml = <<<'EOF'
588
-
589
- collection:
590
- -item1
591
- -item2
592
- -item3
593
-
594
- EOF;
595
-
596
- $this->parser->parse($yaml);
597
- }
598
-
599
- /**
600
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
601
- */
602
- public function testShortcutKeyUnindentedCollectionException()
603
- {
604
- $yaml = <<<'EOF'
605
-
606
- collection:
607
- - key: foo
608
- foo: bar
609
-
610
- EOF;
611
-
612
- $this->parser->parse($yaml);
613
- }
614
-
615
- /**
616
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
617
- * @expectedExceptionMessageRegExp /^Multiple documents are not supported.+/
618
- */
619
- public function testMultipleDocumentsNotSupportedException()
620
- {
621
- Yaml::parse(<<<'EOL'
622
- # Ranking of 1998 home runs
623
- ---
624
- - Mark McGwire
625
- - Sammy Sosa
626
- - Ken Griffey
627
-
628
- # Team ranking
629
- ---
630
- - Chicago Cubs
631
- - St Louis Cardinals
632
- EOL
633
- );
634
- }
635
-
636
- /**
637
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
638
- */
639
- public function testSequenceInAMapping()
640
- {
641
- Yaml::parse(<<<'EOF'
642
- yaml:
643
- hash: me
644
- - array stuff
645
- EOF
646
- );
647
- }
648
-
649
- public function testSequenceInMappingStartedBySingleDashLine()
650
- {
651
- $yaml = <<<'EOT'
652
- a:
653
- -
654
- b:
655
- -
656
- bar: baz
657
- - foo
658
- d: e
659
- EOT;
660
- $expected = array(
661
- 'a' => array(
662
- array(
663
- 'b' => array(
664
- array(
665
- 'bar' => 'baz',
666
- ),
667
- ),
668
- ),
669
- 'foo',
670
- ),
671
- 'd' => 'e',
672
- );
673
-
674
- $this->assertSame($expected, $this->parser->parse($yaml));
675
- }
676
-
677
- public function testSequenceFollowedByCommentEmbeddedInMapping()
678
- {
679
- $yaml = <<<'EOT'
680
- a:
681
- b:
682
- - c
683
- # comment
684
- d: e
685
- EOT;
686
- $expected = array(
687
- 'a' => array(
688
- 'b' => array('c'),
689
- 'd' => 'e',
690
- ),
691
- );
692
-
693
- $this->assertSame($expected, $this->parser->parse($yaml));
694
- }
695
-
696
- /**
697
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
698
- */
699
- public function testMappingInASequence()
700
- {
701
- Yaml::parse(<<<'EOF'
702
- yaml:
703
- - array stuff
704
- hash: me
705
- EOF
706
- );
707
- }
708
-
709
- /**
710
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
711
- * @expectedExceptionMessage missing colon
712
- */
713
- public function testScalarInSequence()
714
- {
715
- Yaml::parse(<<<'EOF'
716
- foo:
717
- - bar
718
- "missing colon"
719
- foo: bar
720
- EOF
721
- );
722
- }
723
-
724
- /**
725
- * > It is an error for two equal keys to appear in the same mapping node.
726
- * > In such a case the YAML processor may continue, ignoring the second
727
- * > `key: value` pair and issuing an appropriate warning. This strategy
728
- * > preserves a consistent information model for one-pass and random access
729
- * > applications.
730
- *
731
- * @see http://yaml.org/spec/1.2/spec.html#id2759572
732
- * @see http://yaml.org/spec/1.1/#id932806
733
- */
734
- public function testMappingDuplicateKeyBlock()
735
- {
736
- $input = <<<'EOD'
737
- parent:
738
- child: first
739
- child: duplicate
740
- parent:
741
- child: duplicate
742
- child: duplicate
743
- EOD;
744
- $expected = array(
745
- 'parent' => array(
746
- 'child' => 'first',
747
- ),
748
- );
749
- $this->assertSame($expected, Yaml::parse($input));
750
- }
751
-
752
- public function testMappingDuplicateKeyFlow()
753
- {
754
- $input = <<<'EOD'
755
- parent: { child: first, child: duplicate }
756
- parent: { child: duplicate, child: duplicate }
757
- EOD;
758
- $expected = array(
759
- 'parent' => array(
760
- 'child' => 'first',
761
- ),
762
- );
763
- $this->assertSame($expected, Yaml::parse($input));
764
- }
765
-
766
- public function testEmptyValue()
767
- {
768
- $input = <<<'EOF'
769
- hash:
770
- EOF;
771
-
772
- $this->assertEquals(array('hash' => null), Yaml::parse($input));
773
- }
774
-
775
- public function testCommentAtTheRootIndent()
776
- {
777
- $this->assertEquals(array(
778
- 'services' => array(
779
- 'app.foo_service' => array(
780
- 'class' => 'Foo',
781
- ),
782
- 'app/bar_service' => array(
783
- 'class' => 'Bar',
784
- ),
785
- ),
786
- ), Yaml::parse(<<<'EOF'
787
- # comment 1
788
- services:
789
- # comment 2
790
- # comment 3
791
- app.foo_service:
792
- class: Foo
793
- # comment 4
794
- # comment 5
795
- app/bar_service:
796
- class: Bar
797
- EOF
798
- ));
799
- }
800
-
801
- public function testStringBlockWithComments()
802
- {
803
- $this->assertEquals(array('content' => <<<'EOT'
804
- # comment 1
805
- header
806
-
807
- # comment 2
808
- <body>
809
- <h1>title</h1>
810
- </body>
811
-
812
- footer # comment3
813
- EOT
814
- ), Yaml::parse(<<<'EOF'
815
- content: |
816
- # comment 1
817
- header
818
-
819
- # comment 2
820
- <body>
821
- <h1>title</h1>
822
- </body>
823
-
824
- footer # comment3
825
- EOF
826
- ));
827
- }
828
-
829
- public function testFoldedStringBlockWithComments()
830
- {
831
- $this->assertEquals(array(array('content' => <<<'EOT'
832
- # comment 1
833
- header
834
-
835
- # comment 2
836
- <body>
837
- <h1>title</h1>
838
- </body>
839
-
840
- footer # comment3
841
- EOT
842
- )), Yaml::parse(<<<'EOF'
843
- -
844
- content: |
845
- # comment 1
846
- header
847
-
848
- # comment 2
849
- <body>
850
- <h1>title</h1>
851
- </body>
852
-
853
- footer # comment3
854
- EOF
855
- ));
856
- }
857
-
858
- public function testNestedFoldedStringBlockWithComments()
859
- {
860
- $this->assertEquals(array(array(
861
- 'title' => 'some title',
862
- 'content' => <<<'EOT'
863
- # comment 1
864
- header
865
-
866
- # comment 2
867
- <body>
868
- <h1>title</h1>
869
- </body>
870
-
871
- footer # comment3
872
- EOT
873
- )), Yaml::parse(<<<'EOF'
874
- -
875
- title: some title
876
- content: |
877
- # comment 1
878
- header
879
-
880
- # comment 2
881
- <body>
882
- <h1>title</h1>
883
- </body>
884
-
885
- footer # comment3
886
- EOF
887
- ));
888
- }
889
-
890
- public function testReferenceResolvingInInlineStrings()
891
- {
892
- $this->assertEquals(array(
893
- 'var' => 'var-value',
894
- 'scalar' => 'var-value',
895
- 'list' => array('var-value'),
896
- 'list_in_list' => array(array('var-value')),
897
- 'map_in_list' => array(array('key' => 'var-value')),
898
- 'embedded_mapping' => array(array('key' => 'var-value')),
899
- 'map' => array('key' => 'var-value'),
900
- 'list_in_map' => array('key' => array('var-value')),
901
- 'map_in_map' => array('foo' => array('bar' => 'var-value')),
902
- ), Yaml::parse(<<<'EOF'
903
- var: &var var-value
904
- scalar: *var
905
- list: [ *var ]
906
- list_in_list: [[ *var ]]
907
- map_in_list: [ { key: *var } ]
908
- embedded_mapping: [ key: *var ]
909
- map: { key: *var }
910
- list_in_map: { key: [*var] }
911
- map_in_map: { foo: { bar: *var } }
912
- EOF
913
- ));
914
- }
915
-
916
- public function testYamlDirective()
917
- {
918
- $yaml = <<<'EOF'
919
- %YAML 1.2
920
- ---
921
- foo: 1
922
- bar: 2
923
- EOF;
924
- $this->assertEquals(array('foo' => 1, 'bar' => 2), $this->parser->parse($yaml));
925
- }
926
-
927
- public function testFloatKeys()
928
- {
929
- $yaml = <<<'EOF'
930
- foo:
931
- 1.2: "bar"
932
- 1.3: "baz"
933
- EOF;
934
-
935
- $expected = array(
936
- 'foo' => array(
937
- '1.2' => 'bar',
938
- '1.3' => 'baz',
939
- ),
940
- );
941
-
942
- $this->assertEquals($expected, $this->parser->parse($yaml));
943
- }
944
-
945
- /**
946
- * @group legacy
947
- * @expectedDeprecation Using a colon in the unquoted mapping value "bar: baz" in line 1 is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.
948
- * throw ParseException in Symfony 3.0
949
- */
950
- public function testColonInMappingValueException()
951
- {
952
- $yaml = <<<'EOF'
953
- foo: bar: baz
954
- EOF;
955
-
956
- $this->parser->parse($yaml);
957
- }
958
-
959
- public function testColonInMappingValueExceptionNotTriggeredByColonInComment()
960
- {
961
- $yaml = <<<'EOT'
962
- foo:
963
- bar: foobar # Note: a comment after a colon
964
- EOT;
965
-
966
- $this->assertSame(array('foo' => array('bar' => 'foobar')), $this->parser->parse($yaml));
967
- }
968
-
969
- /**
970
- * @dataProvider getCommentLikeStringInScalarBlockData
971
- */
972
- public function testCommentLikeStringsAreNotStrippedInBlockScalars($yaml, $expectedParserResult)
973
- {
974
- $this->assertSame($expectedParserResult, $this->parser->parse($yaml));
975
- }
976
-
977
- public function getCommentLikeStringInScalarBlockData()
978
- {
979
- $tests = array();
980
-
981
- $yaml = <<<'EOT'
982
- pages:
983
- -
984
- title: some title
985
- content: |
986
- # comment 1
987
- header
988
-
989
- # comment 2
990
- <body>
991
- <h1>title</h1>
992
- </body>
993
-
994
- footer # comment3
995
- EOT;
996
- $expected = array(
997
- 'pages' => array(
998
- array(
999
- 'title' => 'some title',
1000
- 'content' => <<<'EOT'
1001
- # comment 1
1002
- header
1003
-
1004
- # comment 2
1005
- <body>
1006
- <h1>title</h1>
1007
- </body>
1008
-
1009
- footer # comment3
1010
- EOT
1011
- ,
1012
- ),
1013
- ),
1014
- );
1015
- $tests[] = array($yaml, $expected);
1016
-
1017
- $yaml = <<<'EOT'
1018
- test: |
1019
- foo
1020
- # bar
1021
- baz
1022
- collection:
1023
- - one: |
1024
- foo
1025
- # bar
1026
- baz
1027
- - two: |
1028
- foo
1029
- # bar
1030
- baz
1031
- EOT;
1032
- $expected = array(
1033
- 'test' => <<<'EOT'
1034
- foo
1035
- # bar
1036
- baz
1037
-
1038
- EOT
1039
- ,
1040
- 'collection' => array(
1041
- array(
1042
- 'one' => <<<'EOT'
1043
- foo
1044
- # bar
1045
- baz
1046
-
1047
- EOT
1048
- ,
1049
- ),
1050
- array(
1051
- 'two' => <<<'EOT'
1052
- foo
1053
- # bar
1054
- baz
1055
- EOT
1056
- ,
1057
- ),
1058
- ),
1059
- );
1060
- $tests[] = array($yaml, $expected);
1061
-
1062
- $yaml = <<<'EOT'
1063
- foo:
1064
- bar:
1065
- scalar-block: >
1066
- line1
1067
- line2>
1068
- baz:
1069
- # comment
1070
- foobar: ~
1071
- EOT;
1072
- $expected = array(
1073
- 'foo' => array(
1074
- 'bar' => array(
1075
- 'scalar-block' => "line1 line2>\n",
1076
- ),
1077
- 'baz' => array(
1078
- 'foobar' => null,
1079
- ),
1080
- ),
1081
- );
1082
- $tests[] = array($yaml, $expected);
1083
-
1084
- $yaml = <<<'EOT'
1085
- a:
1086
- b: hello
1087
- # c: |
1088
- # first row
1089
- # second row
1090
- d: hello
1091
- EOT;
1092
- $expected = array(
1093
- 'a' => array(
1094
- 'b' => 'hello',
1095
- 'd' => 'hello',
1096
- ),
1097
- );
1098
- $tests[] = array($yaml, $expected);
1099
-
1100
- return $tests;
1101
- }
1102
-
1103
- public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
1104
- {
1105
- $yaml = <<<'EOT'
1106
- test: >
1107
- <h2>A heading</h2>
1108
-
1109
- <ul>
1110
- <li>a list</li>
1111
- <li>may be a good example</li>
1112
- </ul>
1113
- EOT;
1114
-
1115
- $this->assertSame(
1116
- array(
1117
- 'test' => <<<'EOT'
1118
- <h2>A heading</h2>
1119
- <ul> <li>a list</li> <li>may be a good example</li> </ul>
1120
- EOT
1121
- ,
1122
- ),
1123
- $this->parser->parse($yaml)
1124
- );
1125
- }
1126
-
1127
- public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
1128
- {
1129
- $yaml = <<<'EOT'
1130
- test: >
1131
- <h2>A heading</h2>
1132
-
1133
- <ul>
1134
- <li>a list</li>
1135
- <li>may be a good example</li>
1136
- </ul>
1137
- EOT;
1138
-
1139
- $this->assertSame(
1140
- array(
1141
- 'test' => <<<'EOT'
1142
- <h2>A heading</h2>
1143
- <ul>
1144
- <li>a list</li>
1145
- <li>may be a good example</li>
1146
- </ul>
1147
- EOT
1148
- ,
1149
- ),
1150
- $this->parser->parse($yaml)
1151
- );
1152
- }
1153
-
1154
- /**
1155
- * @param $lineNumber
1156
- * @param $yaml
1157
- * @dataProvider parserThrowsExceptionWithCorrectLineNumberProvider
1158
- */
1159
- public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yaml)
1160
- {
1161
- if (method_exists($this, 'expectException')) {
1162
- $this->expectException('\Symfony\Component\Yaml\Exception\ParseException');
1163
- $this->expectExceptionMessage(sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
1164
- } else {
1165
- $this->setExpectedException('\Symfony\Component\Yaml\Exception\ParseException', sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
1166
- }
1167
-
1168
- $this->parser->parse($yaml);
1169
- }
1170
-
1171
- public function parserThrowsExceptionWithCorrectLineNumberProvider()
1172
- {
1173
- return array(
1174
- array(
1175
- 4,
1176
- <<<'YAML'
1177
- foo:
1178
- -
1179
- # bar
1180
- bar: "123",
1181
- YAML
1182
- ),
1183
- array(
1184
- 5,
1185
- <<<'YAML'
1186
- foo:
1187
- -
1188
- # bar
1189
- # bar
1190
- bar: "123",
1191
- YAML
1192
- ),
1193
- array(
1194
- 8,
1195
- <<<'YAML'
1196
- foo:
1197
- -
1198
- # foobar
1199
- baz: 123
1200
- bar:
1201
- -
1202
- # bar
1203
- bar: "123",
1204
- YAML
1205
- ),
1206
- array(
1207
- 10,
1208
- <<<'YAML'
1209
- foo:
1210
- -
1211
- # foobar
1212
- # foobar
1213
- baz: 123
1214
- bar:
1215
- -
1216
- # bar
1217
- # bar
1218
- bar: "123",
1219
- YAML
1220
- ),
1221
- );
1222
- }
1223
-
1224
- public function testCanParseVeryLongValue()
1225
- {
1226
- $longStringWithSpaces = str_repeat('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ', 20000);
1227
- $trickyVal = array('x' => $longStringWithSpaces);
1228
-
1229
- $yamlString = Yaml::dump($trickyVal);
1230
- $arrayFromYaml = $this->parser->parse($yamlString);
1231
-
1232
- $this->assertEquals($trickyVal, $arrayFromYaml);
1233
- }
1234
-
1235
- /**
1236
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
1237
- * @expectedExceptionMessage Reference "foo" does not exist at line 2
1238
- */
1239
- public function testParserCleansUpReferencesBetweenRuns()
1240
- {
1241
- $yaml = <<<YAML
1242
- foo: &foo
1243
- baz: foobar
1244
- bar:
1245
- <<: *foo
1246
- YAML;
1247
- $this->parser->parse($yaml);
1248
-
1249
- $yaml = <<<YAML
1250
- bar:
1251
- <<: *foo
1252
- YAML;
1253
- $this->parser->parse($yaml);
1254
- }
1255
-
1256
- public function testParseReferencesOnMergeKeys()
1257
- {
1258
- $yaml = <<<YAML
1259
- mergekeyrefdef:
1260
- a: foo
1261
- <<: &quux
1262
- b: bar
1263
- c: baz
1264
- mergekeyderef:
1265
- d: quux
1266
- <<: *quux
1267
- YAML;
1268
- $expected = array(
1269
- 'mergekeyrefdef' => array(
1270
- 'a' => 'foo',
1271
- 'b' => 'bar',
1272
- 'c' => 'baz',
1273
- ),
1274
- 'mergekeyderef' => array(
1275
- 'd' => 'quux',
1276
- 'b' => 'bar',
1277
- 'c' => 'baz',
1278
- ),
1279
- );
1280
-
1281
- $this->assertSame($expected, $this->parser->parse($yaml));
1282
- }
1283
-
1284
- /**
1285
- * @expectedException \Symfony\Component\Yaml\Exception\ParseException
1286
- * @expectedExceptionMessage Reference "foo" does not exist
1287
- */
1288
- public function testEvalRefException()
1289
- {
1290
- $yaml = <<<EOE
1291
- foo: { &foo { a: Steve, <<: *foo} }
1292
- EOE;
1293
- $this->parser->parse($yaml);
1294
- }
1295
- }
1296
-
1297
- class B
1298
- {
1299
- public $b = 'foo';
1300
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Tests/YamlTest.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml\Tests;
13
-
14
- use PHPUnit\Framework\TestCase;
15
- use Symfony\Component\Yaml\Yaml;
16
-
17
- class YamlTest extends TestCase
18
- {
19
- public function testParseAndDump()
20
- {
21
- $data = array('lorem' => 'ipsum', 'dolor' => 'sit');
22
- $yml = Yaml::dump($data);
23
- $parsed = Yaml::parse($yml);
24
- $this->assertEquals($data, $parsed);
25
- }
26
-
27
- /**
28
- * @group legacy
29
- */
30
- public function testLegacyParseFromFile()
31
- {
32
- $filename = __DIR__.'/Fixtures/index.yml';
33
- $contents = file_get_contents($filename);
34
- $parsedByFilename = Yaml::parse($filename);
35
- $parsedByContents = Yaml::parse($contents);
36
- $this->assertEquals($parsedByFilename, $parsedByContents);
37
- }
38
-
39
- /**
40
- * @expectedException \InvalidArgumentException
41
- * @expectedExceptionMessage The indentation must be greater than zero
42
- */
43
- public function testZeroIndentationThrowsException()
44
- {
45
- Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, 0);
46
- }
47
-
48
- /**
49
- * @expectedException \InvalidArgumentException
50
- * @expectedExceptionMessage The indentation must be greater than zero
51
- */
52
- public function testNegativeIndentationThrowsException()
53
- {
54
- Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, -4);
55
- }
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Unescaper.php DELETED
@@ -1,156 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml;
13
-
14
- /**
15
- * Unescaper encapsulates unescaping rules for single and double-quoted
16
- * YAML strings.
17
- *
18
- * @author Matthew Lewinski <matthew@lewinski.org>
19
- *
20
- * @internal
21
- */
22
- class Unescaper
23
- {
24
- /**
25
- * Parser and Inline assume UTF-8 encoding, so escaped Unicode characters
26
- * must be converted to that encoding.
27
- *
28
- * @deprecated since version 2.5, to be removed in 3.0
29
- *
30
- * @internal
31
- */
32
- const ENCODING = 'UTF-8';
33
-
34
- /**
35
- * Regex fragment that matches an escaped character in a double quoted string.
36
- */
37
- const REGEX_ESCAPED_CHARACTER = '\\\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.)';
38
-
39
- /**
40
- * Unescapes a single quoted string.
41
- *
42
- * @param string $value A single quoted string
43
- *
44
- * @return string The unescaped string
45
- */
46
- public function unescapeSingleQuotedString($value)
47
- {
48
- return str_replace('\'\'', '\'', $value);
49
- }
50
-
51
- /**
52
- * Unescapes a double quoted string.
53
- *
54
- * @param string $value A double quoted string
55
- *
56
- * @return string The unescaped string
57
- */
58
- public function unescapeDoubleQuotedString($value)
59
- {
60
- $self = $this;
61
- $callback = function ($match) use ($self) {
62
- return $self->unescapeCharacter($match[0]);
63
- };
64
-
65
- // evaluate the string
66
- return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value);
67
- }
68
-
69
- /**
70
- * Unescapes a character that was found in a double-quoted string.
71
- *
72
- * @param string $value An escaped character
73
- *
74
- * @return string The unescaped character
75
- *
76
- * @internal This method is public to be usable as callback. It should not
77
- * be used in user code. Should be changed in 3.0.
78
- */
79
- public function unescapeCharacter($value)
80
- {
81
- switch ($value[1]) {
82
- case '0':
83
- return "\x0";
84
- case 'a':
85
- return "\x7";
86
- case 'b':
87
- return "\x8";
88
- case 't':
89
- return "\t";
90
- case "\t":
91
- return "\t";
92
- case 'n':
93
- return "\n";
94
- case 'v':
95
- return "\xB";
96
- case 'f':
97
- return "\xC";
98
- case 'r':
99
- return "\r";
100
- case 'e':
101
- return "\x1B";
102
- case ' ':
103
- return ' ';
104
- case '"':
105
- return '"';
106
- case '/':
107
- return '/';
108
- case '\\':
109
- return '\\';
110
- case 'N':
111
- // U+0085 NEXT LINE
112
- return "\xC2\x85";
113
- case '_':
114
- // U+00A0 NO-BREAK SPACE
115
- return "\xC2\xA0";
116
- case 'L':
117
- // U+2028 LINE SEPARATOR
118
- return "\xE2\x80\xA8";
119
- case 'P':
120
- // U+2029 PARAGRAPH SEPARATOR
121
- return "\xE2\x80\xA9";
122
- case 'x':
123
- return self::utf8chr(hexdec(substr($value, 2, 2)));
124
- case 'u':
125
- return self::utf8chr(hexdec(substr($value, 2, 4)));
126
- case 'U':
127
- return self::utf8chr(hexdec(substr($value, 2, 8)));
128
- default:
129
- @trigger_error('Not escaping a backslash in a double-quoted string is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', E_USER_DEPRECATED);
130
-
131
- return $value;
132
- }
133
- }
134
-
135
- /**
136
- * Get the UTF-8 character for the given code point.
137
- *
138
- * @param int $c The unicode code point
139
- *
140
- * @return string The corresponding UTF-8 character
141
- */
142
- private static function utf8chr($c)
143
- {
144
- if (0x80 > $c %= 0x200000) {
145
- return \chr($c);
146
- }
147
- if (0x800 > $c) {
148
- return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F);
149
- }
150
- if (0x10000 > $c) {
151
- return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F);
152
- }
153
-
154
- return \chr(0xF0 | $c >> 18).\chr(0x80 | $c >> 12 & 0x3F).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F);
155
- }
156
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/Yaml.php DELETED
@@ -1,99 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Symfony\Component\Yaml;
13
-
14
- use Symfony\Component\Yaml\Exception\ParseException;
15
-
16
- /**
17
- * Yaml offers convenience methods to load and dump YAML.
18
- *
19
- * @author Fabien Potencier <fabien@symfony.com>
20
- */
21
- class Yaml
22
- {
23
- /**
24
- * Parses YAML into a PHP value.
25
- *
26
- * Usage:
27
- *
28
- * $array = Yaml::parse(file_get_contents('config.yml'));
29
- * print_r($array);
30
- *
31
- * As this method accepts both plain strings and file names as an input,
32
- * you must validate the input before calling this method. Passing a file
33
- * as an input is a deprecated feature and will be removed in 3.0.
34
- *
35
- * Note: the ability to pass file names to the Yaml::parse method is deprecated since Symfony 2.2 and will be removed in 3.0. Pass the YAML contents of the file instead.
36
- *
37
- * @param string $input Path to a YAML file or a string containing YAML
38
- * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise
39
- * @param bool $objectSupport True if object support is enabled, false otherwise
40
- * @param bool $objectForMap True if maps should return a stdClass instead of array()
41
- *
42
- * @return mixed The YAML converted to a PHP value
43
- *
44
- * @throws ParseException If the YAML is not valid
45
- */
46
- public static function parse($input, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false)
47
- {
48
- // if input is a file, process it
49
- $file = '';
50
- if (false === strpos($input, "\n") && is_file($input)) {
51
- @trigger_error('The ability to pass file names to the '.__METHOD__.' method is deprecated since Symfony 2.2 and will be removed in 3.0. Pass the YAML contents of the file instead.', E_USER_DEPRECATED);
52
-
53
- if (false === is_readable($input)) {
54
- throw new ParseException(sprintf('Unable to parse "%s" as the file is not readable.', $input));
55
- }
56
-
57
- $file = $input;
58
- $input = file_get_contents($file);
59
- }
60
-
61
- $yaml = new Parser();
62
-
63
- try {
64
- return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport, $objectForMap);
65
- } catch (ParseException $e) {
66
- if ($file) {
67
- $e->setParsedFile($file);
68
- }
69
-
70
- throw $e;
71
- }
72
- }
73
-
74
- /**
75
- * Dumps a PHP value to a YAML string.
76
- *
77
- * The dump method, when supplied with an array, will do its best
78
- * to convert the array into friendly YAML.
79
- *
80
- * @param mixed $input The PHP value
81
- * @param int $inline The level where you switch to inline YAML
82
- * @param int $indent The amount of spaces to use for indentation of nested nodes
83
- * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
84
- * @param bool $objectSupport True if object support is enabled, false otherwise
85
- *
86
- * @return string A YAML string representing the original PHP value
87
- */
88
- public static function dump($input, $inline = 2, $indent = 4, $exceptionOnInvalidType = false, $objectSupport = false)
89
- {
90
- if ($indent < 1) {
91
- throw new \InvalidArgumentException('The indentation must be greater than zero.');
92
- }
93
-
94
- $yaml = new Dumper();
95
- $yaml->setIndentation($indent);
96
-
97
- return $yaml->dump($input, $inline, 0, $exceptionOnInvalidType, $objectSupport);
98
- }
99
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/composer.json DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "name": "symfony/yaml",
3
- "type": "library",
4
- "description": "Symfony Yaml Component",
5
- "keywords": [],
6
- "homepage": "https://symfony.com",
7
- "license": "MIT",
8
- "authors": [
9
- {
10
- "name": "Fabien Potencier",
11
- "email": "fabien@symfony.com"
12
- },
13
- {
14
- "name": "Symfony Community",
15
- "homepage": "https://symfony.com/contributors"
16
- }
17
- ],
18
- "require": {
19
- "php": ">=5.3.9",
20
- "symfony/polyfill-ctype": "~1.8"
21
- },
22
- "autoload": {
23
- "psr-4": { "Symfony\\Component\\Yaml\\": "" },
24
- "exclude-from-classmap": [
25
- "/Tests/"
26
- ]
27
- },
28
- "minimum-stability": "dev",
29
- "extra": {
30
- "branch-alias": {
31
- "dev-master": "2.8-dev"
32
- }
33
- }
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/symfony/yaml/phpunit.xml.dist DELETED
@@ -1,30 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
-
3
- <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
- xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
5
- backupGlobals="false"
6
- colors="true"
7
- bootstrap="vendor/autoload.php"
8
- failOnRisky="true"
9
- failOnWarning="true"
10
- >
11
- <php>
12
- <ini name="error_reporting" value="-1" />
13
- </php>
14
-
15
- <testsuites>
16
- <testsuite name="Symfony Yaml Component Test Suite">
17
- <directory>./Tests/</directory>
18
- </testsuite>
19
- </testsuites>
20
-
21
- <filter>
22
- <whitelist>
23
- <directory>./</directory>
24
- <exclude>
25
- <directory>./Tests</directory>
26
- <directory>./vendor</directory>
27
- </exclude>
28
- </whitelist>
29
- </filter>
30
- </phpunit>