File tree Expand file tree Collapse file tree 2 files changed +22
-10
lines changed Expand file tree Collapse file tree 2 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -25,20 +25,16 @@ function __construct()
2525 */
2626 public function get ($ name )
2727 {
28- $ configfile = (new ConfigFile )->get ();
28+ $ configfile = new ConfigFile ;
29+ $ configarr = $ configfile ->get ();
2930
3031 if (!empty ($ this ->configkey ) && count ($ configfile )) {
3132
32- $ encenv_config = ['cipher ' => '' ];
33- if (file_exists (config_path ('encryptenv.php ' ))) {
34- $ encenv_config = require (config_path ('encryptenv.php ' ));
35- }
33+ $ crypt = new Encrypter ($ this ->configkey , $ configfile ->getEncEnvConfig ()['cipher ' ]);
3634
37- $ crypt = new Encrypter ($ this ->configkey , $ encenv_config ['cipher ' ]);
38-
39- return !empty ($ configfile [$ name ]) && !is_array ($ configfile [$ name ]) && strpos ($ configfile [$ name ], "ENC: " ) === 0 ?
40- $ crypt ->decrypt (substr ($ configfile [$ name ], 4 )) :
41- null ;
35+ return !empty ($ configarr [$ name ]) && !is_array ($ configarr [$ name ]) && strpos ($ configarr [$ name ], "ENC: " ) === 0 ?
36+ $ crypt ->decrypt (substr ($ configarr [$ name ], 4 )) :
37+ null ;
4238 }
4339 return null ;
4440 }
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ class ConfigFile
99 */
1010 protected $ configarr ;
1111
12+ /**
13+ * @var array
14+ */
15+ protected $ encenv_config ;
16+
1217 /**
1318 * @var string
1419 */
@@ -29,6 +34,7 @@ function __construct()
2934 {
3035 if (file_exists (config_path ('encryptenv.php ' ))) {
3136 $ encenv_config = require (config_path ('encryptenv.php ' ));
37+ $ this ->encenv_config = $ encenv_config ;
3238 }
3339 $ this ->configfile = !empty ($ encenv_config ['custom_config_file ' ]) ? $ encenv_config ['custom_config_file ' ] : null ;
3440 !empty ($ encenv_config ['custom_config_file ' ]) && $ this ->configpath = config_path ($ encenv_config ['custom_config_file ' ]);
@@ -54,6 +60,16 @@ public function get()
5460 return $ this ->configarr ;
5561 }
5662
63+ /**
64+ * Get Package Config properties as array
65+ *
66+ * @return array
67+ */
68+ public function getEncEnvConfig ()
69+ {
70+ return $ this ->encenv_config ;
71+ }
72+
5773 /**
5874 * Get Config File Path
5975 *
You can’t perform that action at this time.
0 commit comments