Skip to content

Commit 7c6173f

Browse files
committed
cleaning up code
1 parent 659af6e commit 7c6173f

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/Illuminate/Cache/Console/ClearCommand.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,21 @@ public function __construct(CacheManager $cache)
5050
*/
5151
public function handle()
5252
{
53-
$storeName = $this->hasArgument('store') ? $this->argument('store') : null;
54-
$tagsNames = $this->hasOption('tags') ? $this->option('tags') : null;
53+
$tags = (array) explode(',', $this->option('tags'));
5554

56-
$store = $this->cache->store($storeName);
55+
$cache = $this->cache->store($store = $this->argument('store'));
5756

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

60-
if (! is_null($tagsNames)) {
61-
$store->tags(explode(',', $tagsNames))->flush();
62-
63-
$this->info(sprintf('Application cache tags "%s" cleared!', $tagsNames));
59+
if (! empty($tags)) {
60+
$cache->tags($tags)->flush();
6461
} else {
65-
$store->flush();
66-
67-
$this->info('Application cache cleared!');
62+
$cache->flush();
6863
}
6964

70-
$this->laravel['events']->fire('cache:cleared', [$storeName, $tagsNames]);
65+
$this->info('Cache cleared successfully.');
66+
67+
$this->laravel['events']->fire('cache:cleared', [$store, $tags]);
7168
}
7269

7370
/**

0 commit comments

Comments
 (0)