CronBehavior   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Saito - The Threaded Web Forum
7
 *
8
 * @copyright Copyright (c) the Saito Project Developers
9
 * @link https://github.com/Schlaefer/Saito
10
 * @license http://opensource.org/licenses/MIT
11
 */
12
13
namespace Cron\Model\Behavior;
14
15
use Cake\ORM\Behavior;
16
use Saito\App\Registry;
17
18
class CronBehavior extends Behavior
19
{
20
    /**
21
     * {@inheritDoc}
22
     *
23
     * Register table cron-jobs as behavior config.
24
     */
25
    public function initialize(array $config)
26
    {
27
        $cron = Registry::get('Cron');
28
        foreach ($config as $func => $options) {
29
            $cron->addCronJob(
30
                $options['id'],
31
                $options['due'],
32
                [$this->_table, $func]
33
            );
34
        }
35
    }
36
}
37