Passed
Pull Request — master (#8)
by Kevin
19:20
created

BetweenTimeHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A supports() 0 3 1
A filterTask() 0 3 1
1
<?php
2
3
namespace Zenstruck\ScheduleBundle\Schedule\Extension\Handler;
4
5
use Zenstruck\ScheduleBundle\Schedule\Extension;
6
use Zenstruck\ScheduleBundle\Schedule\Extension\BetweenTimeExtension;
7
use Zenstruck\ScheduleBundle\Schedule\Extension\ExtensionHandler;
8
use Zenstruck\ScheduleBundle\Schedule\Task\TaskRunContext;
9
10
/**
11
 * @author Kevin Bond <[email protected]>
12
 */
13
final class BetweenTimeHandler extends ExtensionHandler
14
{
15
    /**
16
     * @param BetweenTimeExtension|Extension $extension
17
     */
18
    public function filterTask(TaskRunContext $context, Extension $extension): void
19
    {
20
        $extension->filter($context->getTask()->getTimezone());
0 ignored issues
show
Bug introduced by
The method filter() does not exist on Zenstruck\ScheduleBundle\Schedule\Extension. It seems like you code against a sub-type of Zenstruck\ScheduleBundle\Schedule\Extension such as Zenstruck\ScheduleBundle...on\BetweenTimeExtension. ( Ignorable by Annotation )

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

20
        $extension->/** @scrutinizer ignore-call */ 
21
                    filter($context->getTask()->getTimezone());
Loading history...
21
    }
22
23
    public function supports(Extension $extension): bool
24
    {
25
        return $extension instanceof BetweenTimeExtension;
26
    }
27
}
28