GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Scheduler::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace WyriHaximus\React;
4
5
use React\EventLoop\LoopInterface;
6
7
final class Scheduler implements SchedulerInterface
8
{
9
    /** @var LoopInterface */
10
    private $loop;
11
12
    /**
13
     * Scheduler constructor.
14
     * @param LoopInterface $loop
15
     */
16 4
    public function __construct(LoopInterface $loop)
17
    {
18 4
        $this->loop = $loop;
19 4
    }
20
21 4
    public function schedule(callable $tick): void
22
    {
23
        // Tick every 60 seconds
24
        $this->loop->addPeriodicTimer(60, function () use ($tick): void {
25 2
            $tick();
26 4
        });
27
28
        // Initial tick because some actions might want to run in this minute
29 4
        $tick();
30 4
    }
31
}
32