Completed
Push — master ( 2b7f2d...31c8a2 )
by stéphane
03:00
created

example.php (1 issue)

1
<?php
2
require_once __DIR__.'/vendor/autoload.php';
0 ignored issues
show
Missing file doc comment
Loading history...
3
4
use \Dallgoot\Yaml\Yaml as Y;
5
6
/**
7
 * Display some use cases for Yaml library
8
 */
9
10
/* USE CASE 1
11
* load and parse if file exists
12
*/
13
$yaml = Y::parseFile('./tests/cases/examples/Example_2_26.yml', null, 2); //->parse();
14
// $yaml = Y::parseFile('./references/Example 2.27.yml', null, 1);
15
var_dump($yaml);
16
exit(0);
17
// USE CASE 2
18
$a = <<<EOF
19
sequence:
20
    - string_key: 1
21
EOF;
22
$b = <<<EOF
23
#2
24
mapping:
25
    string_key: 1
26
EOF;
27
var_dump(Y::parse($a));
28
var_dump(Y::parse($b));
29
30
// USE CASE 3
31
// $yamlObjList = [];
32
// $yloader = new Loader();
33
// foreach(['file1', 'file2', 'file3'] as $key => $fileName)
34
// {
35
//     $yamlObjList[] =  $yloader->load($fileName)->parse();
36
// }
37