Laravel version update
Laravel version update
This commit is contained in:
6
vendor/vlucas/phpdotenv/composer.json
vendored
6
vendor/vlucas/phpdotenv/composer.json
vendored
@@ -2,7 +2,7 @@
|
||||
"name": "vlucas/phpdotenv",
|
||||
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
|
||||
"keywords": ["env", "dotenv", "environment"],
|
||||
"license" : "BSD-3-Clause-Attribution",
|
||||
"license" : "BSD-3-Clause",
|
||||
"authors" : [
|
||||
{
|
||||
"name": "Vance Lucas",
|
||||
@@ -14,7 +14,7 @@
|
||||
"php": ">=5.3.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8 || ^5.0"
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.4-dev"
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
31
vendor/vlucas/phpdotenv/src/Dotenv.php
vendored
31
vendor/vlucas/phpdotenv/src/Dotenv.php
vendored
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Dotenv;
|
||||
|
||||
use Dotenv\Exception\InvalidPathException;
|
||||
|
||||
/**
|
||||
* This is the dotenv class.
|
||||
*
|
||||
@@ -48,6 +50,21 @@ class Dotenv
|
||||
return $this->loadData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load environment file in given directory, suppress InvalidPathException.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function safeLoad()
|
||||
{
|
||||
try {
|
||||
return $this->loadData();
|
||||
} catch (InvalidPathException $e) {
|
||||
// suppressing exception
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load environment file in given directory.
|
||||
*
|
||||
@@ -86,9 +103,7 @@ class Dotenv
|
||||
*/
|
||||
protected function loadData($overload = false)
|
||||
{
|
||||
$this->loader = new Loader($this->filePath, !$overload);
|
||||
|
||||
return $this->loader->load();
|
||||
return $this->loader->setImmutable(!$overload)->load();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,4 +117,14 @@ class Dotenv
|
||||
{
|
||||
return new Validator((array) $variable, $this->loader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of environment variables declared inside the 'env' file.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getEnvironmentVariableNames()
|
||||
{
|
||||
return $this->loader->variableNames;
|
||||
}
|
||||
}
|
||||
|
75
vendor/vlucas/phpdotenv/src/Loader.php
vendored
75
vendor/vlucas/phpdotenv/src/Loader.php
vendored
@@ -28,6 +28,13 @@ class Loader
|
||||
*/
|
||||
protected $immutable;
|
||||
|
||||
/**
|
||||
* The list of environment variables declared inside the 'env' file.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $variableNames = array();
|
||||
|
||||
/**
|
||||
* Create a new loader instance.
|
||||
*
|
||||
@@ -42,6 +49,29 @@ class Loader
|
||||
$this->immutable = $immutable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set immutable value.
|
||||
*
|
||||
* @param bool $immutable
|
||||
* @return $this
|
||||
*/
|
||||
public function setImmutable($immutable = false)
|
||||
{
|
||||
$this->immutable = $immutable;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get immutable value.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getImmutable()
|
||||
{
|
||||
return $this->immutable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `.env` file in given directory.
|
||||
*
|
||||
@@ -92,9 +122,7 @@ class Loader
|
||||
*/
|
||||
protected function normaliseEnvironmentVariable($name, $value)
|
||||
{
|
||||
list($name, $value) = $this->splitCompoundStringIntoParts($name, $value);
|
||||
list($name, $value) = $this->sanitiseVariableName($name, $value);
|
||||
list($name, $value) = $this->sanitiseVariableValue($name, $value);
|
||||
list($name, $value) = $this->processFilters($name, $value);
|
||||
|
||||
$value = $this->resolveNestedVariables($value);
|
||||
|
||||
@@ -104,7 +132,7 @@ class Loader
|
||||
/**
|
||||
* Process the runtime filters.
|
||||
*
|
||||
* Called from the `VariableFactory`, passed as a callback in `$this->loadFromFile()`.
|
||||
* Called from `normaliseEnvironmentVariable` and the `VariableFactory`, passed as a callback in `$this->loadFromFile()`.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
@@ -147,7 +175,9 @@ class Loader
|
||||
*/
|
||||
protected function isComment($line)
|
||||
{
|
||||
return strpos(ltrim($line), '#') === 0;
|
||||
$line = ltrim($line);
|
||||
|
||||
return isset($line[0]) && $line[0] === '#';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,16 +233,16 @@ class Loader
|
||||
$quote = $value[0];
|
||||
$regexPattern = sprintf(
|
||||
'/^
|
||||
%1$s # match a quote at the start of the value
|
||||
( # capturing sub-pattern used
|
||||
(?: # we do not need to capture this
|
||||
[^%1$s\\\\] # any character other than a quote or backslash
|
||||
|\\\\\\\\ # or two backslashes together
|
||||
|\\\\%1$s # or an escaped quote e.g \"
|
||||
)* # as many characters that match the previous rules
|
||||
) # end of the capturing sub-pattern
|
||||
%1$s # and the closing quote
|
||||
.*$ # and discard any string after the closing quote
|
||||
%1$s # match a quote at the start of the value
|
||||
( # capturing sub-pattern used
|
||||
(?: # we do not need to capture this
|
||||
[^%1$s\\\\]* # any character other than a quote or backslash
|
||||
|\\\\\\\\ # or two backslashes together
|
||||
|\\\\%1$s # or an escaped quote e.g \"
|
||||
)* # as many characters that match the previous rules
|
||||
) # end of the capturing sub-pattern
|
||||
%1$s # and the closing quote
|
||||
.*$ # and discard any string after the closing quote
|
||||
/mx',
|
||||
$quote
|
||||
);
|
||||
@@ -225,7 +255,12 @@ class Loader
|
||||
|
||||
// Unquoted values cannot contain whitespace
|
||||
if (preg_match('/\s+/', $value) > 0) {
|
||||
throw new InvalidFileException('Dotenv values containing spaces must be surrounded by quotes.');
|
||||
// Check if value is a comment (usually triggered when empty value with comment)
|
||||
if (preg_match('/^#/', $value) > 0) {
|
||||
$value = '';
|
||||
} else {
|
||||
throw new InvalidFileException('Dotenv values containing spaces must be surrounded by quotes.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +270,7 @@ class Loader
|
||||
/**
|
||||
* Resolve the nested variables.
|
||||
*
|
||||
* Look for {$varname} patterns in the variable value and replace with an
|
||||
* Look for ${varname} patterns in the variable value and replace with an
|
||||
* existing environment variable.
|
||||
*
|
||||
* @param string $value
|
||||
@@ -247,7 +282,7 @@ class Loader
|
||||
if (strpos($value, '$') !== false) {
|
||||
$loader = $this;
|
||||
$value = preg_replace_callback(
|
||||
'/\${([a-zA-Z0-9_]+)}/',
|
||||
'/\${([a-zA-Z0-9_.]+)}/',
|
||||
function ($matchedPatterns) use ($loader) {
|
||||
$nestedVariable = $loader->getEnvironmentVariable($matchedPatterns[1]);
|
||||
if ($nestedVariable === null) {
|
||||
@@ -287,7 +322,7 @@ class Loader
|
||||
*/
|
||||
protected function beginsWithAQuote($value)
|
||||
{
|
||||
return strpbrk($value[0], '"\'') !== false;
|
||||
return isset($value[0]) && ($value[0] === '"' || $value[0] === '\'');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -329,6 +364,8 @@ class Loader
|
||||
{
|
||||
list($name, $value) = $this->normaliseEnvironmentVariable($name, $value);
|
||||
|
||||
$this->variableNames[] = $name;
|
||||
|
||||
// Don't overwrite existing environment variables if we're immutable
|
||||
// Ruby's dotenv does this with `ENV[key] ||= value`.
|
||||
if ($this->immutable && $this->getEnvironmentVariable($name) !== null) {
|
||||
|
19
vendor/vlucas/phpdotenv/src/Validator.php
vendored
19
vendor/vlucas/phpdotenv/src/Validator.php
vendored
@@ -77,6 +77,25 @@ class Validator
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that each specified variable is a boolean.
|
||||
*
|
||||
* @return \Dotenv\Validator
|
||||
*/
|
||||
public function isBoolean()
|
||||
{
|
||||
return $this->assertCallback(
|
||||
function ($value) {
|
||||
if ($value === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== NULL);
|
||||
},
|
||||
'is not a boolean'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that each variable is amongst the given choices.
|
||||
*
|
||||
|
Reference in New Issue
Block a user