You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
I came to the following question/thoughts by chance, when I'v started implement a writer capable to write array configuration into multiple files. It splits configuration by criteria, currently hard-coded by key, later by strategy defined, into different files and join them in a stub-file, which includes the config from separate files.
I use it for example in zfcampus/zf-configuration, to reduce the configuration file size and split top level keys into separate files. This way I can find things much quicker, if further module-separation is not possible/logical.
Now everything works fine, but I'v noticed, that the API defined by WriterInterface does not make much sense in my new writer, because toString() would only return the stub-file contents.
This made me think about two possibilities: Either my implementation of WriterInterface is misusing this interface and it is actually something else, that should internally use Writers, but is itself not a writer or the current spec for Writer in zend-config is to concrete.
My conclusion so far is:
The job of my WriterInterface implementation is really to write the configuration, not something do something else. How it writers, in a single or multiple files, or even maybe not in a file, does not make it something else, than a writer.
Actually the current WriterInterface is rather something like a FileWriterInterface. A configuration should actually be writable to indefinite type of targets.
Example how it seem logical to me, but if I'm wrong with my thought somewhere, correct me:
I came to the following question/thoughts by chance, when I'v started implement a writer capable to write array configuration into multiple files. It splits configuration by criteria, currently hard-coded by key, later by strategy defined, into different files and join them in a stub-file, which includes the config from separate files.
I use it for example in
zfcampus/zf-configuration
, to reduce the configuration file size and split top level keys into separate files. This way I can find things much quicker, if further module-separation is not possible/logical.Now everything works fine, but I'v noticed, that the API defined by
WriterInterface
does not make much sense in my new writer, because toString() would only return the stub-file contents.This made me think about two possibilities: Either my implementation of
WriterInterface
is misusing this interface and it is actually something else, that should internally use Writers, but is itself not a writer or the current spec for Writer in zend-config is to concrete.My conclusion so far is:
WriterInterface
implementation is really to write the configuration, not something do something else. How it writers, in a single or multiple files, or even maybe not in a file, does not make it something else, than a writer.WriterInterface
is rather something like aFileWriterInterface
. A configuration should actually be writable to indefinite type of targets.Example how it seem logical to me, but if I'm wrong with my thought somewhere, correct me:
Whether Interfaces like the
FileWriterInterface
are actually needed then is another question.What do you think about it?
The text was updated successfully, but these errors were encountered: