-
-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Description
Let's have following messagess.neon file:
a:
b: Some text
c: Some other text
d: someKey:
e: Some next message
f: Hello world
We want to parse this file by Decoder, the decoded values encode by Encoder and save the file back, because we want fix "Neon coding standards" in this file. Like remove unneeded ",' etc...
The common problem is, that the Encoder properly fix the Neon coding standards, but generates also unneeded newlines and tabs.
Let's have following code:
$file = file_get_contents('messages.neon');
$decoder = new Decoder;
$decoded = $decoder->decode($file);
$encoder = new Encoder;
$encoded = $encoder->encode($decoded, Encoder::BLOCK);
file_put_contents('messages.neon', $encoded);And the result of messages.neon?
a:
b: Some text
c: Some other text
d: someKey:
e: Some next message
#two tabs
#one tab
f: Hello world
Metadata
Metadata
Assignees
Labels
No labels