Skip to content

Added process of null and numbers #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ DATABASE_DNS=mysql:host=localhost;dbname=test;
DATABASE_USER="root"
DATABASE_PASSWORD=root
MODULE_ENABLED=true
NUMBER_LITERAL=0
NULL_VALUE=null
```

## Load the variables
Expand Down Expand Up @@ -57,6 +59,20 @@ var_dump(getenv('DATABASE_USER'));
* bool(true)
*/
var_dump(getenv('MODULE_ENABLED'));

/**
* Process the numeric value:
*
* int(0)
*/
var_dump(getenv('NUMBER_LITERAL'));

/**
* Check for literal null values:
*
* NULL
*/
var_dump(getenv('NULL_VALUE'));
```

Ideal for small project
Expand All @@ -76,3 +92,13 @@ NOTE: ``VARIABLE="true"`` will be processed to ```string(4) "true"```
## QuotedProcessor

``VARIABLE="anything"`` will be processed to ```string(8) "anything"```

## NullProcessor

``VARIABLE=null`` will be processed to ```NULL```

## NumberProcessor

``VARIABLE=0`` will be processed to ```int(0)```

``VARIABLE=0.1`` will be processed to ```float(0.1)```
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
"Test\\DevCoder\\": "tests"
}
},
"scripts": {
"test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --testdox",
"test:coverage": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --testdox --coverage-clover build/logs/clover.xml --coverage-html build/coverage"
},
"require": {
"php": ">=7.4"
},
"require-dev": {
"phpunit/phpunit": "^9.4"
"phpunit/phpunit": "9.6.3"
}
}
108 changes: 54 additions & 54 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading