Expression   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 15
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getNextRun() 0 6 1
1
<?php
2
3
namespace BrainExe\Core\Cron;
4
5
use BrainExe\Core\Annotations\Service;
6
use Cron\CronExpression;
7
8
/**
9
 * @Service
10
 */
11
class Expression
12
{
13
14
    /**
15
     * @param string $expression
16
     * @param string $currentTime
17
     * @return int
18
     */
19 3
    public function getNextRun(string $expression, $currentTime = 'now') : int
20
    {
21 3
        $cron = CronExpression::factory($expression);
22
23 3
        return $cron->getNextRunDate($currentTime)->getTimestamp();
24
    }
25
}
26