99use Imdhemy \Purchases \ServiceProviders \LiapServiceProvider ;
1010
1111/**
12- * Config publish command.
13- *
14- * This command is used to publish LIAP configuration file
12+ * This command is used to publish LIAP configuration file.
1513 */
1614class LiapConfigPublishCommand extends Command
1715{
18- /**
19- * @const string The failure message to display if file is already published
20- */
2116 public const MESSAGE_ALREADY_INSTALLED = 'liap.php is already published. ' ;
22-
23- /**
24- * @const string The success message to display if file is published successfully
25- */
2617 public const MESSAGE_SUCCESS = 'liap.php published successfully ' ;
2718
2819 protected $ signature = 'liap:config:publish {--f|force} ' ;
2920
3021 protected $ description = 'Publishes the LIAP configuration file. ' ;
3122
32- /**
33- * Executes the console command.
34- */
3523 public function handle (): int
3624 {
3725 if ($ this ->shouldForce ()) {
3826 return $ this ->publishConfig (true );
3927 }
4028
4129 if ($ this ->isInstalled ()) {
42- return $ this ->fail ();
30+ return $ this ->publishFailed ();
4331 }
4432
4533 return $ this ->publishConfig ();
@@ -53,9 +41,6 @@ private function shouldForce(): bool
5341 return (bool )$ this ->option ('force ' );
5442 }
5543
56- /**
57- * Publish configurations.
58- */
5944 private function publishConfig (bool $ force = false ): int
6045 {
6146 $ params = [
@@ -73,18 +58,12 @@ private function publishConfig(bool $force = false): int
7358 return $ result ;
7459 }
7560
76- /**
77- * Check if the freya is installed.
78- */
7961 private function isInstalled (): bool
8062 {
8163 return File::exists (config_path (LiapServiceProvider::CONFIG_KEY .'.php ' ));
8264 }
8365
84- /**
85- * Should run on command failure.
86- */
87- private function fail (): int
66+ private function publishFailed (): int
8867 {
8968 $ this ->error (self ::MESSAGE_ALREADY_INSTALLED );
9069
0 commit comments