Issues (238)

src/Commands/CacheFlushCommand.php (6 issues)

1
<?php
2
3
namespace Translation\Commands;
4
5
use Illuminate\Console\Command;
0 ignored issues
show
The type Illuminate\Console\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Translation\Cache\CacheRepositoryInterface as CacheRepository;
7
8
class CacheFlushCommand extends Command
9
{
10
    /**
11
     * The console command name.
12
     *
13
     * @var string
14
     */
15
    protected $name = 'translator:flush';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = "Flush the translation cache.";
23
24
    /**
25
     *  Create the cache flushed command
26
     *
27
     * @param \Waavi\Lang\Providers\LanguageProvider      $languageRepository
0 ignored issues
show
The type Waavi\Lang\Providers\LanguageProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
     * @param \Waavi\Lang\Providers\LanguageEntryProvider $translationRepository
0 ignored issues
show
The type Waavi\Lang\Providers\LanguageEntryProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
29
     * @param \Illuminate\Foundation\Application          $app
0 ignored issues
show
The type Illuminate\Foundation\Application was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
30
     */
31
    public function __construct(CacheRepository $cacheRepository, $cacheEnabled)
32
    {
33
        parent::__construct();
34
        $this->cacheRepository = $cacheRepository;
0 ignored issues
show
Bug Best Practice introduced by
The property cacheRepository does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
35
        $this->cacheEnabled    = $cacheEnabled;
0 ignored issues
show
Bug Best Practice introduced by
The property cacheEnabled does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
36
    }
37
38
    /**
39
     *  Execute the console command.
40
     *
41
     * @return void
42
     */
43
    public function fire()
44
    {
45
        if (!$this->cacheEnabled) {
46
            $this->info('The translation cache is disabled.');
47
        } else {
48
            $this->cacheRepository->flushAll();
49
            $this->info('Translation cache cleared.');
50
        }
51
    }
52
    
53
    /**
54
     * Execute the console command for Laravel 5.5
55
     * this laravel version call handle intead of fire
56
     */
57
    public function handle()
58
    {
59
        $this->fire();
60
    }
61
}
62