Test Failed
Push — master ( e0c95c...ecb0ac )
by Patrick
10:20 queued 15s
created

PeriodicalActivityPlugin::collect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 10
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of forecast.it.fill project.
7
 * (c) Patrick Jaja <[email protected]>
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace ForecastAutomation\PeriodicalActivity\Shared\Plugin;
13
14
use ForecastAutomation\Activity\Shared\Plugin\ActivityPluginInterface;
15
use ForecastAutomation\Kernel\Shared\Plugin\AbstractPlugin;
16
use GuzzleHttp\Promise\Promise;
17
use GuzzleHttp\Promise\PromiseInterface;
18
19
/**
20
 * @method \ForecastAutomation\PeriodicalActivity\PeriodicalActivityFacade getFacade()
21
 */
22
class PeriodicalActivityPlugin extends AbstractPlugin implements ActivityPluginInterface
23
{
24
    public function collect(): PromiseInterface
25
    {
26
        $wrapPromise = new Promise(
27
            function () use (&$wrapPromise) {
28
                $periodicalActivity = $this->getFacade()->generateActivityToDate(date('Y-m-d 00:00'));
29
                $wrapPromise->resolve($periodicalActivity);
30
            }
31
        );
32
33
        return $wrapPromise;
34
    }
35
}
36