previous named Get\ReadEnvFile is no Get\DotEnv, static method is the same. Update for not parsing comments at the end of a line if the line was not in quotes. Strips everything after comment mark and also right trims any trailing spaces Old: FOO=Test # Comment -> $_ENV['FOO'] = "Test # Comment" New: FOO=Test # Comment -> $_ENV['FOO'] = "Test" Add phpUnit tests for DotEnv class. Update config.php with new class name The old class name exists and is markted as deprecated until next major release
50 lines
1.4 KiB
Bash
50 lines
1.4 KiB
Bash
# enviroment file
|
|
SOMETHING=A
|
|
OTHER="B IS B"
|
|
Complex="A B \"D is F"
|
|
# COMMENT
|
|
HAS_SPACE= "ABC";
|
|
# COMMENT AT END
|
|
HAS_COMMENT_QUOTES_SPACE="Comment at end with quotes and space" # Comment QE
|
|
HAS_COMMENT_QUOTES_NO_SPACE="Comment at end with quotes no space"# Comment QES
|
|
HAS_COMMENT_NO_QUOTES_SPACE=Comment at end no quotes and space # Comment NQE
|
|
HAS_COMMENT_NO_QUOTES_NO_SPACE=Comment at end no quotes no space# Comment NQES
|
|
COMMENT_IN_TEXT_QUOTES="Foo bar # comment in here"
|
|
FAILURE = ABC
|
|
SIMPLEBOX= A B C
|
|
TITLE=1
|
|
FOO=1.2
|
|
SOME.TEST=Test Var
|
|
SOME.LIVE=Live Var
|
|
# VAR TESTS -
|
|
A_TEST1 = foo
|
|
A_TEST2 = ${TEST1:-bar} # TEST1 is set so the value of TEST2 = foo
|
|
A_TEST3 = ${TEST4:-bar} # TEST4 is not set so the value of TEST3 = bar
|
|
A_TEST5 = null
|
|
A_TEST6 = ${TEST5-bar} # TEST5 is set but empty so the value of TEST6 = null
|
|
A_TEST7 = ${TEST6:-bar} # TEST5 is set and empty so the value of TEST7 = bar
|
|
# VAR TESTS =
|
|
B_TEST1 = foo
|
|
B_TEST2 = ${TEST1:=bar} # TEST1 is set so the value of TEST2 = foo
|
|
B_TEST3 = ${TEST4:=bar} # TEST4 is not set so the value of TEST3 = bar and TEST4 = bar
|
|
B_TEST5 = null
|
|
B_TEST6 = ${TEST5=bar} # TEST5 is set but emtpy so the value of TEST6 = null
|
|
B_TEST7 = ${TEST6=bar} # TEST5 is set and empty so the value of TEST7 = bar and TEST5 = bar
|
|
# VAR TEST END
|
|
Test="A"
|
|
TEST="B"
|
|
TEST="D"
|
|
LINE="ABC
|
|
DEF"
|
|
OTHERLINE="ABC
|
|
AF\"ASFASDF
|
|
MORESHIT"
|
|
SUPERLINE=
|
|
"asfasfasf"
|
|
__FOO_BAR_1 = b
|
|
__FOOFOO = f
|
|
123123=number
|
|
EMPTY=
|
|
= flase
|
|
asfasdf
|