Skip to content

Commit

Permalink
cleaning up code
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jul 18, 2016
1 parent 659af6e commit 7c6173f
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/Illuminate/Cache/Console/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,21 @@ public function __construct(CacheManager $cache)
*/
public function handle()
{
$storeName = $this->hasArgument('store') ? $this->argument('store') : null;
$tagsNames = $this->hasOption('tags') ? $this->option('tags') : null;
$tags = (array) explode(',', $this->option('tags'));

$store = $this->cache->store($storeName);
$cache = $this->cache->store($store = $this->argument('store'));

$this->laravel['events']->fire('cache:clearing', [$storeName, $tagsNames]);
$this->laravel['events']->fire('cache:clearing', [$store, $tags]);

if (! is_null($tagsNames)) {
$store->tags(explode(',', $tagsNames))->flush();

$this->info(sprintf('Application cache tags "%s" cleared!', $tagsNames));
if (! empty($tags)) {
$cache->tags($tags)->flush();
} else {
$store->flush();

$this->info('Application cache cleared!');
$cache->flush();
}

$this->laravel['events']->fire('cache:cleared', [$storeName, $tagsNames]);
$this->info('Cache cleared successfully.');

$this->laravel['events']->fire('cache:cleared', [$store, $tags]);
}

/**
Expand Down

0 comments on commit 7c6173f

Please sign in to comment.