Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
EnvProcessor Class Reference

Public Member Functions

 __construct (string $envFile='')
 
 putEnvFile (array $config=[])
 
 getEnv ()
 

Detailed Description

Definition at line 15 of file EnvProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( string  $envFile = '')

EnvProcessor constructor.

Parameters
string$envFile

Definition at line 49 of file EnvProcessor.php.

51  {
52  $this->envFile = $envFile;
53  $this->envExists = file_exists($envFile);
54  $this->envExampleFile = realpath(FW_BP . "/etc/config/.env.example");
55  }

Member Function Documentation

◆ getEnv()

getEnv ( )

Retrieves '.env.example' file as associative array.

Returns
array

Definition at line 121 of file EnvProcessor.php.

121  : array
122  {
123  if (empty($this->env)) {
124  $this->env = $this->parseEnvFile();
125  }
126  return $this->env;
127  }

◆ putEnvFile()

putEnvFile ( array  $config = [])

Serves for putting array with environment variables into .env file or appending new variables we introduce

Parameters
array$config
Returns
void

Definition at line 106 of file EnvProcessor.php.

107  {
108  $envData = '';
109  foreach ($config as $key => $value) {
110  $envData .= $key . '=' . $value . PHP_EOL;
111  }
112 
113  file_put_contents($this->envFile, $envData);
114  }
$config
Definition: fraud_order.php:17
$value
Definition: gender.phtml:16

The documentation for this class was generated from the following file: