1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-12 16:14:16 +02:00

feat(support): Simplify parsers and serializers #438

This commit is contained in:
Awilum
2020-07-22 11:11:26 +03:00
parent f3dae27c60
commit 5db796ac64

View File

@@ -82,10 +82,10 @@ class Frontmatter
if (isset($input['content'])) {
$content = $input['content'];
array_delete($input, 'content');
$matter = Yaml::encode($input);
$matter = $this->flextype['yaml']->encode($input);
} else {
$content = '';
$matter = Yaml::encode($input);
$matter = $this->flextype['yaml']->encode($input);
}
$encoded = '---' . "\n" .
@@ -106,6 +106,6 @@ class Frontmatter
return ['content' => trim($input)];
}
return Yaml::decode(trim($parts[1]), false) + ['content' => trim(implode(PHP_EOL . '---' . PHP_EOL, array_slice($parts, 2)))];
return $this->flextype['yaml']->decode(trim($parts[1]), false) + ['content' => trim(implode(PHP_EOL . '---' . PHP_EOL, array_slice($parts, 2)))];
}
}