RefreshScheduler   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 1
1
<?php namespace Comodojo\Extender\Listeners;
2
3
use \League\Event\AbstractListener;
4
use \League\Event\EventInterface;
5
6
/**
7
 * @package     Comodojo Extender
8
 * @author      Marco Giovinazzi <[email protected]>
9
 * @license     MIT
10
 *
11
 * LICENSE:
12
 *
13
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
 * THE SOFTWARE.
20
 */
21
 
22
class RefreshScheduler extends AbstractListener {
23
24
    public function handle(EventInterface $event) {
25
26
        $worker = $event->getWorker()->getInstance();
0 ignored issues
show
Bug introduced by
The method getWorker() does not exist on League\Event\EventInterface. It seems like you code against a sub-type of League\Event\EventInterface such as Comodojo\Daemon\Events\WorkerEvent. ( Ignorable by Annotation )

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

26
        $worker = $event->/** @scrutinizer ignore-call */ getWorker()->getInstance();
Loading history...
27
28
        $logger = $worker->getLogger();
29
30
        $logger->info("Plans changed, refreshing schedule");
31
32
        $worker->refreshPlans();
33
34
        return true;
35
36
    }
37
38
}
39