Skip to content

Commit

Permalink
🎨 Tidy up the acf:ide-helpers command
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Feb 27, 2024
1 parent 08bd1c9 commit 9dcd9c6
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/Console/IdeHelpersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Log1x\AcfComposer\AcfComposer;

class IdeHelpersCommand extends Command
{
Expand All @@ -24,11 +23,6 @@ class IdeHelpersCommand extends Command
*/
protected $description = 'Generate IDE helpers for configured custom field types';

/**
* The ACF Composer instance.
*/
protected AcfComposer $composer;

/**
* Execute the console command.
*/
Expand All @@ -40,6 +34,10 @@ public function handle()
return $this->components->info('You <fg=blue>do not</> have any configured custom field types.');
}

$path = $this->option('path') ?
base_path($this->option('path')) :
__DIR__.'/../../_ide-helpers.php';

$methods = [];

foreach ($types as $key => $value) {
Expand All @@ -50,10 +48,6 @@ public function handle()

$methods = implode("\n\t ", $methods);

$path = $this->option('path') ?
base_path($this->option('path')) :
__DIR__.'/../../_ide-helpers.php';

$builder = <<<EOT
namespace Log1x\AcfComposer {
/**
Expand Down Expand Up @@ -98,8 +92,6 @@ class RepeaterBuilder
}
EOT;

File::ensureDirectoryExists(dirname($path));

File::put($path, "<?php\n\n{$builder}\n\n{$fieldBuilder}");

$this->components->info('The <fg=blue>IDE helpers</> have been successfully generated.');
Expand Down

0 comments on commit 9dcd9c6

Please sign in to comment.