Skip to content

Commit

Permalink
Fixing ENV parsing and adding Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
andrevanzuydam committed Jul 7, 2021
1 parent f57d431 commit 4c5a95b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# tina4php-env
Environment support for your PHP project

An .env will be created for you when the system runs for the first
time. If you specify an environment variable on your OS called ENVIRONMENT then .env.ENVIRONMENT will be loaded instead.

```bash
[Section] <-- Group section
MY_VAR=Test <-- Example declaration, no quotes required or escaping, quotes will be treated as part of the variable
# A commment <-- This is a comment
[Another Section]
VERSION=1.0.0
```
8 changes: 7 additions & 1 deletion Tina4/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ public function __construct(?string $forceEnvironment = "")
$this->readParams($environment);
}


/**
* Parses a line into variables
* @param $line
*/
private function parseLine($line): void
{
if (empty($line)) {
return;
}
if ($line[0] === "#" || empty($line) || ($line[0] === "[" && $line[strlen($line) - 1] === "]")) {
return;
}
Expand Down

0 comments on commit 4c5a95b

Please sign in to comment.