@@ -38,7 +38,7 @@ public function run(array $params)
3838 */
3939 protected function determineSourcePath ()
4040 {
41- $ this ->sourcePath = realpath (__DIR__ . '/../ ' );
41+ $ this ->sourcePath = \ realpath (__DIR__ . '/../ ' );
4242 if ($ this ->sourcePath == '/ ' || empty ($ this ->sourcePath )) {
4343 CLI ::error ('Unable to determine the correct source directory. Bailing. ' );
4444 exit ();
@@ -53,10 +53,10 @@ protected function determineSourcePath()
5353 protected function publishConfig ()
5454 {
5555 $ path = "{$ this ->sourcePath }/Config/Midtrans.php " ;
56- $ content = file_get_contents ($ path );
57- $ content = str_replace ('use CodeIgniter\Config\BaseConfig ' , "use Codenom\Midtrans\Config\Midtrans as MidtransConfig " , $ content );
58- $ content = str_replace ('namespace Codenom\Midtrans\Config ' , 'namespace Config ' , $ content );
59- $ content = str_replace ('extends BaseConfig ' , 'extends MidtransConfig ' , $ content );
56+ $ content = \ file_get_contents ($ path );
57+ $ content = \ str_replace ('use CodeIgniter\Config\BaseConfig ' , "use Codenom\Midtrans\Config\Midtrans as MidtransConfig " , $ content );
58+ $ content = \ str_replace ('namespace Codenom\Midtrans\Config ' , 'namespace Config ' , $ content );
59+ $ content = \ str_replace ('extends BaseConfig ' , 'extends MidtransConfig ' , $ content );
6060 $ this ->writeFile ('Config/Midtrans.php ' , $ content );
6161 }
6262
@@ -72,23 +72,23 @@ protected function writeFile(string $path, string $content)
7272 {
7373 $ config = new Autoload ();
7474 $ appPath = $ config ->psr4 [APP_NAMESPACE ];
75- $ directory = dirname ($ appPath. $ path );
76- if (!is_dir ($ directory )) {
77- mkdir ($ directory , 0777 , true );
75+ $ directory = \ dirname ($ appPath . $ path );
76+ if (!\ is_dir ($ directory )) {
77+ \ mkdir ($ directory , 0777 , true );
7878 }
79- if (file_exists ($ appPath. $ path ) && CLI ::prompt ('Config file already exists, do you want to replace it? ' , ['y ' , 'n ' ]) == 'n ' ) {
79+ if (\ file_exists ($ appPath . $ path ) && CLI ::prompt ('Config file already exists, do you want to replace it? ' , ['y ' , 'n ' ]) == 'n ' ) {
8080 CLI ::error ('Cancelled ' );
8181 exit ();
8282 }
8383
8484 try {
85- write_file ($ appPath. $ path , $ content );
85+ write_file ($ appPath . $ path , $ content );
8686 } catch (\Exception $ e ) {
8787 $ this ->showError ($ e );
8888 exit ();
8989 }
90- $ path = str_replace ($ appPath , '' , $ path );
91- CLI ::write (CLI ::color ('Created: ' , 'yellow ' ). $ path );
90+ $ path = \ str_replace ($ appPath , '' , $ path );
91+ CLI ::write (CLI ::color ('Created: ' , 'yellow ' ) . $ path );
9292 }
9393
9494 //--------------------------------------------------------------------
0 commit comments