Remove deprecated classes and methods, deprecate all named constants
All named constants used inside classes have been deprecated and must now be set from method calls, class init, etc
This commit is contained in:
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace CoreLibs\Get;
|
||||
|
||||
// NOTE: it is recommended to use gullvek\dotenv instead which is a copy of this
|
||||
|
||||
class DotEnv
|
||||
{
|
||||
/** @var string constant comment char, set to # */
|
||||
@@ -29,11 +31,17 @@ class DotEnv
|
||||
* 1 for file loadable, no data or data already loaded
|
||||
* 2 for file not readable or open failed
|
||||
* 3 for file not found
|
||||
* @deprecated Use composer package gullevek\dotenv instead -> \gullevek\dotenv\DotEnv::readEnvFile(...)
|
||||
*/
|
||||
public static function readEnvFile(
|
||||
string $path = __DIR__,
|
||||
string $env_file = '.env'
|
||||
): int {
|
||||
trigger_error(
|
||||
'\CoreLibs\Get\DotEnv is deprecated in favor for '
|
||||
. 'composer package gullevek\dotenv which is a copy of this',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
// default -1;
|
||||
$status = -1;
|
||||
$env_file_target = $path . DIRECTORY_SEPARATOR . $env_file;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace CoreLibs\Get;
|
||||
|
||||
/**
|
||||
* @deprecated use \CoreLibs\Get\DotEnv instead
|
||||
*/
|
||||
class ReadEnvFile
|
||||
{
|
||||
/**
|
||||
* parses .env file
|
||||
*
|
||||
* Rules for .env file
|
||||
* variable is any alphanumeric string followed by = on the same line
|
||||
* content starts with the first non space part
|
||||
* strings can be contained in "
|
||||
* strings MUST be contained in " if they are multiline
|
||||
* if string starts with " it will match until another " is found
|
||||
* anything AFTER " is ignored
|
||||
* if there are two variables with the same name only the first is used
|
||||
* variables are case sensitive
|
||||
*
|
||||
* @param string $path Folder to file, default is __DIR__
|
||||
* @param string $env_file What file to load, default is .env
|
||||
* @return int -1 other error
|
||||
* 0 for success full load
|
||||
* 1 for file loadable, but no data inside
|
||||
* 2 for file not readable or open failed
|
||||
* 3 for file not found
|
||||
* @deprecated Use \CoreLibs\Get\DotEnv::readEnvFile() instead
|
||||
*/
|
||||
public static function readEnvFile(
|
||||
string $path = __DIR__,
|
||||
string $env_file = '.env'
|
||||
): int {
|
||||
return \CoreLibs\Get\DotEnv::readEnvFile($path, $env_file);
|
||||
}
|
||||
}
|
||||
|
||||
// __END__
|
||||
Reference in New Issue
Block a user