Services   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 7
c 1
b 0
f 0
dl 0
loc 24
ccs 0
cts 4
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A scheduler() 0 7 3
A cronExpression() 0 7 3
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of BlitzPHP Tasks.
7
 *
8
 * (c) 2025 Dimitri Sitchet Tomkeu <[email protected]>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13
14
namespace BlitzPHP\Tasks\Config;
15
16
use BlitzPHP\Container\Services as BaseServices;
17
use BlitzPHP\Tasks\CronExpression;
18
use BlitzPHP\Tasks\Scheduler;
19
20
class Services extends BaseServices
21
{
22
    /**
23
     * Renvoie le planificateur de tâches
24
     */
25
    public static function scheduler(bool $shared = true): Scheduler
26
    {
27
        if (true === $shared && isset(static::$instances[Scheduler::class])) {
28
            return static::$instances[Scheduler::class];
29
        }
30
31
        return static::$instances[Scheduler::class] = new Scheduler();
32
    }
33
34
    /**
35
     * Renvoie la classe CronExpression.
36
     */
37
    public static function cronExpression(bool $shared = true): CronExpression
38
    {
39
        if (true === $shared && isset(static::$instances[CronExpression::class])) {
40
            return static::$instances[CronExpression::class];
41
        }
42
43
        return static::$instances[CronExpression::class] = new CronExpression();
44
    }
45
}
46