1 | <?php |
||
2 | require_once __DIR__ . '/vendor/autoload.php'; |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
3 | |||
4 | use \Dallgoot\Yaml as Y; |
||
5 | |||
6 | /* USE CASE 1 |
||
7 | * load and parse if file exists |
||
8 | */ |
||
9 | // $yaml = Y::loadFile('./dummy.yml');//->parse(); |
||
10 | $yaml = Y::parseFile('./references/Example 2.12.yml', null, 2); |
||
11 | var_dump($yaml); |
||
12 | exit(0); |
||
13 | // USE CASE 2 |
||
14 | $a = <<<EOF |
||
15 | sequence: |
||
16 | - string_key: 1 |
||
17 | EOF; |
||
18 | $b = <<<EOF |
||
19 | #2 |
||
20 | mapping: |
||
21 | string_key: 1 |
||
22 | EOF; |
||
23 | var_dump(Y::parse($a)); |
||
24 | var_dump(Y::parse($b)); |
||
25 | |||
26 | // USE CASE 3 |
||
27 | // $yamlObjList = []; |
||
28 | // $yloader = new Loader(); |
||
29 | // foreach(['file1', 'file2', 'file3'] as $key => $fileName) |
||
30 | // { |
||
31 | // $yamlObjList[] = $yloader->load($fileName)->parse(); |
||
32 | // } |
||
33 |