src/Env.php
private function saveEnv($array)
    {
        if (is_array($array)) {
            $newArray = [];
            $i = 0;
            foreach ($array as $env) {

                if (preg_match('/\s/', $env['value']) > 0 && (strpos($env['value'], '"') > 0 && strpos($env['value'], '"', -0) > 0)) {
                    $env['value'] = '"'.$env['value'].'"';
                }
                $newArray[$i] = $env['key']."=".$env['value'];
                $i++;
            }
            $newArray = implode("\n", $newArray);
            file_put_contents($this->env, $newArray);
            return true;
        }
        return false;
    }
private function saveEnv($array)
    {
        if (is_array($array)) {
            $newArray = [];
            $i = 0;
            foreach ($array as $env) {

                if (preg_match('/\s/', $env['value']) > 0 && (strpos($env['value'], '"') > 0 && strpos($env['value'], '"', -0) > 0)) {
                    $env['value'] = '"'.$env['value'].'"';
                }
                $newArray[$i] = $env['key']."=".$env['value'];
                $i++;
            }
            $newArray = implode("\n", $newArray);
            file_put_contents($this->env, $newArray);
            return true;
        }
        return false;
    }
private function saveEnv ( $ array ) { if ( is_array ( $ array ) ) { $ newArray = [ ] ; $ i = 0 ; foreach ( $ array as $ env ) { if ( preg_match ( '/\s/' , $ env [ 'value' ] ) > 0 && ( strpos ( $ env [ 'value' ] , '"' ) > 0 && strpos ( $ env [ 'value' ] , '"' , - 0 ) > 0 ) ) { $ env [ 'value' ] = '"' . $ env [ 'value' ] . '"' ; } $ newArray [ $ i ] = $ env [ 'key' ] . "=" . $ env [ 'value' ] ; $ i ++ ; } $ newArray = implode ( "\n" , $ newArray ) ; file_put_contents ( $ this -> env , $ newArray ) ; return true ; } return false ; }
Save .env variable.
@param $array
@return bool
Save . env variable .