upgraded dependencies
This commit is contained in:
66
vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php
vendored
Normal file
66
vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\None;
|
||||
|
||||
class ApacheAdapter implements AvailabilityInterface, ReaderInterface, WriterInterface
|
||||
{
|
||||
/**
|
||||
* Determines if the adapter is supported.
|
||||
*
|
||||
* This happens if PHP is running as an Apache module.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSupported()
|
||||
{
|
||||
return function_exists('apache_getenv') && function_exists('apache_setenv');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an environment variable, if it exists.
|
||||
*
|
||||
* This is intentionally not implemented, since this adapter exists only as
|
||||
* a means to overwrite existing apache environment variables.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string|null>
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
return None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an environment variable.
|
||||
*
|
||||
* Only if an existing apache variable exists do we overwrite it.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value = null)
|
||||
{
|
||||
if (apache_getenv($name) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
apache_setenv($name, (string) $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clear($name)
|
||||
{
|
||||
// Nothing to do here.
|
||||
}
|
||||
}
|
||||
67
vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php
vendored
Normal file
67
vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Some;
|
||||
|
||||
class ArrayAdapter implements AvailabilityInterface, ReaderInterface, WriterInterface
|
||||
{
|
||||
/**
|
||||
* The variables and their values.
|
||||
*
|
||||
* @var array<non-empty-string,string|null>
|
||||
*/
|
||||
private $variables = [];
|
||||
|
||||
/**
|
||||
* Determines if the adapter is supported.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSupported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string|null>
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
if (!array_key_exists($name, $this->variables)) {
|
||||
return None::create();
|
||||
}
|
||||
|
||||
return Some::create($this->variables[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value = null)
|
||||
{
|
||||
$this->variables[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clear($name)
|
||||
{
|
||||
unset($this->variables[$name]);
|
||||
}
|
||||
}
|
||||
13
vendor/vlucas/phpdotenv/src/Repository/Adapter/AvailabilityInterface.php
vendored
Normal file
13
vendor/vlucas/phpdotenv/src/Repository/Adapter/AvailabilityInterface.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
interface AvailabilityInterface
|
||||
{
|
||||
/**
|
||||
* Determines if the adapter is supported.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSupported();
|
||||
}
|
||||
72
vendor/vlucas/phpdotenv/src/Repository/Adapter/EnvConstAdapter.php
vendored
Normal file
72
vendor/vlucas/phpdotenv/src/Repository/Adapter/EnvConstAdapter.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Some;
|
||||
|
||||
class EnvConstAdapter implements AvailabilityInterface, ReaderInterface, WriterInterface
|
||||
{
|
||||
/**
|
||||
* Determines if the adapter is supported.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSupported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string|null>
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
if (!array_key_exists($name, $_ENV)) {
|
||||
return None::create();
|
||||
}
|
||||
|
||||
$value = $_ENV[$name];
|
||||
|
||||
if (is_scalar($value)) {
|
||||
/** @var \PhpOption\Option<string|null> */
|
||||
return Some::create((string) $value);
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
/** @var \PhpOption\Option<string|null> */
|
||||
return Some::create(null);
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value = null)
|
||||
{
|
||||
$_ENV[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clear($name)
|
||||
{
|
||||
unset($_ENV[$name]);
|
||||
}
|
||||
}
|
||||
56
vendor/vlucas/phpdotenv/src/Repository/Adapter/PutenvAdapter.php
vendored
Normal file
56
vendor/vlucas/phpdotenv/src/Repository/Adapter/PutenvAdapter.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\Option;
|
||||
|
||||
class PutenvAdapter implements AvailabilityInterface, ReaderInterface, WriterInterface
|
||||
{
|
||||
/**
|
||||
* Determines if the adapter is supported.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSupported()
|
||||
{
|
||||
return function_exists('getenv') && function_exists('putenv');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string|null>
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
/** @var \PhpOption\Option<string|null> */
|
||||
return Option::fromValue(getenv($name), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value = null)
|
||||
{
|
||||
putenv("$name=$value");
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clear($name)
|
||||
{
|
||||
putenv($name);
|
||||
}
|
||||
}
|
||||
15
vendor/vlucas/phpdotenv/src/Repository/Adapter/ReaderInterface.php
vendored
Normal file
15
vendor/vlucas/phpdotenv/src/Repository/Adapter/ReaderInterface.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
interface ReaderInterface extends AvailabilityInterface
|
||||
{
|
||||
/**
|
||||
* Get an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string|null>
|
||||
*/
|
||||
public function get($name);
|
||||
}
|
||||
72
vendor/vlucas/phpdotenv/src/Repository/Adapter/ServerConstAdapter.php
vendored
Normal file
72
vendor/vlucas/phpdotenv/src/Repository/Adapter/ServerConstAdapter.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Some;
|
||||
|
||||
class ServerConstAdapter implements AvailabilityInterface, ReaderInterface, WriterInterface
|
||||
{
|
||||
/**
|
||||
* Determines if the adapter is supported.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSupported()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an environment variable, if it exists.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return \PhpOption\Option<string|null>
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
if (!array_key_exists($name, $_SERVER)) {
|
||||
return None::create();
|
||||
}
|
||||
|
||||
$value = $_SERVER[$name];
|
||||
|
||||
if (is_scalar($value)) {
|
||||
/** @var \PhpOption\Option<string|null> */
|
||||
return Some::create((string) $value);
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
/** @var \PhpOption\Option<string|null> */
|
||||
return Some::create(null);
|
||||
}
|
||||
|
||||
return None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value = null)
|
||||
{
|
||||
$_SERVER[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clear($name)
|
||||
{
|
||||
unset($_SERVER[$name]);
|
||||
}
|
||||
}
|
||||
25
vendor/vlucas/phpdotenv/src/Repository/Adapter/WriterInterface.php
vendored
Normal file
25
vendor/vlucas/phpdotenv/src/Repository/Adapter/WriterInterface.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Dotenv\Repository\Adapter;
|
||||
|
||||
interface WriterInterface extends AvailabilityInterface
|
||||
{
|
||||
/**
|
||||
* Set an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
* @param string|null $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($name, $value = null);
|
||||
|
||||
/**
|
||||
* Clear an environment variable.
|
||||
*
|
||||
* @param non-empty-string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clear($name);
|
||||
}
|
||||
Reference in New Issue
Block a user