Kernel::schedule()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of laravel.su package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
declare(strict_types=1);
10
11
namespace App\Console;
12
13
use Illuminate\Console\Scheduling\Schedule;
14
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
15
16
/**
17
 * Class Kernel.
18
 *
19
 * Это основной класс всех консольных команд.
20
 * Зачем и для чего он можно найти в документации.
21
 *
22
 * @see https://laravel.com/docs/5.4/lifecycle#lifecycle-overview
23
 */
24
class Kernel extends ConsoleKernel
25
{
26
    /**
27
     * Все консольные команды регистрируются в этом поле.
28
     *
29
     * @see https://laravel.com/docs/5.4/artisan
30
     * @var array
31
     */
32
    protected $commands = [
33
        Commands\IdeHelperRun::class,
34
        Commands\ArticlesImport::class,
35
        Commands\GitHubDocsSync::class,
36
    ];
37
38
    /**
39
     * Тут регистрируются команды, которые будут выполняться раз в определённый промежуток времени.
40
     *
41
     * @see https://laravel.com/docs/5.4/scheduling
42
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
43
     */
44
    protected function schedule(Schedule $schedule): void
45
    {
46
        $schedule->command('articles:import')
47
            ->hourly();
48
49
        $schedule->command('docs:sync')
50
            ->dailyAt('01:01');
51
    }
52
53
    /**
54
     * Регистрация команд, основанных на замыканиях.
55
     *
56
     * @see https://laravel.com/docs/5.4/artisan#closure-commands
57
     */
58
    protected function commands(): void
59
    {
60
        require base_path('routes/console.php');
61
    }
62
}
63