1 | <?php |
||
2 | |||
3 | namespace PhpCache\Commands; |
||
4 | |||
5 | use PhpCache\CacheClient\CacheClient; |
||
6 | use PhpCache\ServiceManager\ServiceManager; |
||
7 | use Symfony\Component\Console\Command\Command; |
||
8 | use Symfony\Component\Console\Input\InputArgument; |
||
9 | |||
10 | /** |
||
11 | * Description of SetCommand. |
||
12 | * |
||
13 | * @author dude920228 |
||
14 | */ |
||
15 | class SetCommand extends Command |
||
16 | { |
||
17 | private $serviceManager; |
||
18 | |||
19 | public function __construct($config, $name = null) |
||
20 | { |
||
21 | parent::__construct($name); |
||
22 | $this->serviceManager = new ServiceManager($config); |
||
23 | } |
||
24 | |||
25 | protected function configure() |
||
26 | { |
||
27 | $this->setName('set'); |
||
28 | $this->setHelp('This command allows you to create entries in the cache pool'); |
||
29 | $this->addArgument('key', InputArgument::REQUIRED, 'The key assigned to the cache entry'); |
||
30 | $this->addArgument('value', InputArgument::REQUIRED, 'The value of the cache entry'); |
||
31 | } |
||
32 | |||
33 | protected function execute($input, $output) |
||
34 | { |
||
35 | $this->set($input, $output); |
||
36 | } |
||
37 | |||
38 | private function set($input, $output) |
||
0 ignored issues
–
show
|
|||
39 | { |
||
40 | /* @var $client CacheClient */ |
||
41 | $client = $this->serviceManager->get(CacheClient::class); |
||
42 | $client->set($input->getArgument('key'), $input->getArgument('value')); |
||
43 | } |
||
44 | } |
||
45 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.