Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
only ask for the path once when invoking the comand(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenluijten committed Oct 2, 2018
1 parent b9a212f commit c355f6d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
9 changes: 5 additions & 4 deletions src/Commands/MakeView.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class MakeView extends Command
*/
public function handle()
{
$generator = new Generator($this->getConfig());
$path = $this->getPath();

$generator = new Generator($this->getConfig(), $path);

$generator->generate(
(new BlockStack)->build($this->input, $this->getPath())
(new BlockStack)->build($this->input, $path)
);

$this->info('View created successfully.');
Expand All @@ -44,8 +46,7 @@ private function getConfig()
->setName($this->argument('name'))
->setExtension($this->option('extension'))
->setResource($this->option('resource'))
->setVerbs(...$this->option('verb'))
->setPath($this->getPath());
->setVerbs(...$this->option('verb'));
}

private function getPath()
Expand Down
7 changes: 2 additions & 5 deletions src/Commands/ScrapView.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public function handle()
return;
}

$destroyer = new Destroyer($config);

$destroyer->destroy();
(new Destroyer($config, $this->getPath()))->destroy();

$this->info('View scrapped successfully.');
}
Expand All @@ -50,8 +48,7 @@ protected function getConfig()
->setExtension($this->option('extension'))
->setResource($this->option('resource'))
->setVerbs(...$this->option('verb'))
->setForce($this->option('force'))
->setPath($this->getPath());
->setForce($this->option('force'));
}

private function getPath()
Expand Down
4 changes: 3 additions & 1 deletion src/ViewActor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ abstract class ViewActor
* ViewActor constructor.
*
* @param \Sven\ArtisanView\Config $config
* @param string $path
*/
public function __construct(Config $config)
public function __construct(Config $config, $path)
{
$this->config = $config;
$this->config->setPath($path);
}

/**
Expand Down

0 comments on commit c355f6d

Please sign in to comment.