src/Foundation/Services/Environment.php
/**
	 * Parses and loads environment variables from a string in dotenv format.
	 *
	 * @param string $data
	 * @return void
	 */
Parses and loads environment variables from a string in dotenv format.
@param string $data
@return void
Parses and loads environment variables from a string in dotenv format . @param string $data @return void
private static function injectDotEnvString($data) {
		$contents = preg_split("/\r\n|\n|\r/", trim($data));
		foreach ($contents as $lineNumber => $line) {
			$line = trim($line);
			$splitIndex = strpos($line, '=');
			if (empty($line) || starts_with($line, '#')) {
				continue;
			}
			if ($splitIndex === false) {
				throw new Exception("Error parsing .env file on line $lineNumber");
			}
			$key = strtolower(substr($line, 0, $splitIndex));
			$value = substr($line, $splitIndex + 1);
			static::$fileData[$key] = $value;
		}
	}
private static function injectDotEnvString ( $ data ) { $ contents = preg_split ( " / \r \n | \n | \r / " , trim ( $ data ) ) ; foreach ( $ contents as $ lineNumber => $ line ) { $ line = trim ( $ line ) ; $ splitIndex = strpos ( $ line , '=' ) ; if ( empty ( $ line ) || starts_with ( $ line , '#' ) ) { continue ; } if ( $ splitIndex === false ) { throw new Exception ( " Error parsing .env file on line  $ lineNumber " ) ; } $ key = strtolower ( substr ( $ line , 0 , $ splitIndex ) ) ; $ value = substr ( $ line , $ splitIndex + 1 ) ; static :: $ fileData [ $ key ] = $ value ; } }
Parses and loads environment variables from a string in dotenv format.
Parses and loads environment variables from a string in dotenv format .