Passed
Push — develop ( 19a517...90693d )
by Nikolay
05:54 queued 10s
created

CacheCleanerPlugin   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
dl 0
loc 22
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A beforeDispatch() 0 12 3
1
<?php
2
/**
3
 * Copyright (C) MIKO LLC - All Rights Reserved
4
 * Unauthorized copying of this file, via any medium is strictly prohibited
5
 * Proprietary and confidential
6
 * Written by Nikolay Beketov, 6 2018
7
 *
8
 */
9
10
namespace MikoPBX\AdminCabinet\Plugins;
11
12
use MikoPBX\Core\System\BeanstalkClient;
13
use Phalcon\Di\Injectable;
14
use Phalcon\Events\Event;
15
use Phalcon\Mvc\Dispatcher;
16
17
/**
18
 * CacheCleanerPlugin
19
 *
20
 * Check messages on clean cache queue
21
 */
22
class CacheCleanerPlugin extends Injectable
23
{
24
    /**
25
     * This action is executed before execute any action in the application
26
     *
27
     * @param Event      $event
28
     * @param Dispatcher $dispatcher
29
     *
30
     * @return bool
31
     */
32
    public function beforeDispatch(/** @scrutinizer ignore-unused */ Event $event, Dispatcher $dispatcher): bool
0 ignored issues
show
Unused Code introduced by
The parameter $dispatcher is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

32
    public function beforeDispatch(/** @scrutinizer ignore-unused */ Event $event, /** @scrutinizer ignore-unused */ Dispatcher $dispatcher): bool

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
33
    {
34
        $client = new BeanstalkClient(self::class);
35
36
        $arrayOfClearedModels = $client->getMessagesFromTube();
37
        foreach ($arrayOfClearedModels as $clearedModel){
38
            if (class_exists($clearedModel)){
39
                call_user_func([$clearedModel, 'clearCache'], $clearedModel);
40
            }
41
        }
42
43
        return true;
44
    }
45
}
46