Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Apps/Controller/Admin/Main/ActionYandexToken.php (1 issue)

Checks if the types of the passed arguments in a function/method call are compatible.

Bug Minor
1
<?php
2
3
namespace Apps\Controller\Admin\Main;
4
5
6
use Apps\Model\Admin\Main\FormYandexToken;
7
use Ffcms\Core\App;
8
use Ffcms\Core\Arch\View;
9
use Ffcms\Core\Helper\Date;
10
use Ffcms\Core\Network\Request;
11
use Ffcms\Core\Network\Response;
12
13
/**
14
 * Trait ActionYandexToken
15
 * @package Apps\Controller\Admin\Main
16
 * @property Request $request
17
 * @property Response $response
18
 * @property View $view
19
 */
20
trait ActionYandexToken
21
{
22
    /**
23
     * @return string|null
24
     * @throws \Ffcms\Core\Exception\SyntaxException
25
     */
26
    public function yandexToken(): ?string
27
    {
28
        $cfg = App::$Properties->getAll('Yandex');
29
30
        $model = new FormYandexToken($cfg);
0 ignored issues
show
It seems like $cfg can also be of type null; however, parameter $configs of Apps\Model\Admin\Main\Fo...dexToken::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
        $model = new FormYandexToken(/** @scrutinizer ignore-type */ $cfg);
Loading history...
31
        if ($model->send() && $model->validate()) {
32
            $model->make();
33
            App::$Session->getFlashBag()->add('success', __('Token saved successful. Valid until: %date%', [
34
                'date' => Date::convertToDatetime(time() + $model->expires, Date::FORMAT_TO_DAY)
35
            ]));
36
            $this->response->redirect('main/yandexcounter');
37
        }
38
39
        return $this->view->render('main/yandex_token', [
40
            'model' => $model
41
        ]);
42
    }
43
}