src/Env.php
private function getEnv($id = null)
    {
        $string = file_get_contents($this->env);
        $string = preg_split('/\n+/', $string);
        $array = [];
        foreach ($string as $k => $one) {
            if (preg_match('/^(#\s)/', $one) === 1 || preg_match('/^([\\n\\r]+)/', $one)) {
                continue;
            }
            $entry = explode("=", $one, 2);
            if (!empty($entry[0])) {
                $array[] = ['id' => $k + 1, 'key' => $entry[0], 'value' => isset($entry[1]) ? $entry[1] : null];
            }
        }
        if (empty($id)) {
            return $array;
        }
        $index = array_search($id, array_column($array, 'id'));

        return $array[$index];
    }
private function getEnv($id = null)
    {
        $string = file_get_contents($this->env);
        $string = preg_split('/\n+/', $string);
        $array = [];
        foreach ($string as $k => $one) {
            if (preg_match('/^(#\s)/', $one) === 1 || preg_match('/^([\\n\\r]+)/', $one)) {
                continue;
            }
            $entry = explode("=", $one, 2);
            if (!empty($entry[0])) {
                $array[] = ['id' => $k + 1, 'key' => $entry[0], 'value' => isset($entry[1]) ? $entry[1] : null];
            }
        }
        if (empty($id)) {
            return $array;
        }
        $index = array_search($id, array_column($array, 'id'));

        return $array[$index];
    }
private function getEnv ( $ id = null ) { $ string = file_get_contents ( $ this -> env ) ; $ string = preg_split ( '/\n+/' , $ string ) ; $ array = [ ] ; foreach ( $ string as $ k => $ one ) { if ( preg_match ( '/^(#\s)/' , $ one ) === 1 || preg_match ( '/^([\\n\\r]+)/' , $ one ) ) { continue ; } $ entry = explode ( "=" , $ one , 2 ) ; if ( ! empty ( $ entry [ 0 ] ) ) { $ array [ ] = [ 'id' => $ k + 1 , 'key' => $ entry [ 0 ] , 'value' => isset ( $ entry [ 1 ] ) ? $ entry [ 1 ] : null ] ; } } if ( empty ( $ id ) ) { return $ array ; } $ index = array_search ( $ id , array_column ( $ array , 'id' ) ) ; return $ array [ $ index ] ; }
Get .env variable.
@param null $id
@return array|mixed
Get . env variable .