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

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

Labels
Severity
1
<?php
2
3
namespace Apps\Controller\Admin\Main;
4
5
6
use Apps\Model\Admin\Main\FormYandexConnect;
7
use Ffcms\Core\App;
8
use Ffcms\Core\Arch\View;
9
use Ffcms\Core\Network\Request;
10
use Ffcms\Core\Network\Response;
11
12
/**
13
 * Trait ActionYandexConnect
14
 * @package Apps\Controller\Admin\Main
15
 * @property Request $request
16
 * @property Response $response
17
 * @property View $view
18
 */
19
trait ActionYandexConnect
20
{
21
22
    /**
23
     * Connect yandex metrika and get token
24
     * @return string|null
25
     * @throws \Ffcms\Core\Exception\SyntaxException
26
     */
27
    public function yandexConnect(): ?string
28
    {
29
        $configs = App::$Properties->getAll('yandex');
30
31
        $model = new FormYandexConnect($configs);
0 ignored issues
show
It seems like $configs can also be of type null; however, parameter $configs of Apps\Model\Admin\Main\Fo...xConnect::__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

31
        $model = new FormYandexConnect(/** @scrutinizer ignore-type */ $configs);
Loading history...
32
        if ($model->send() && $model->validate()) {
33
            App::$Session->getFlashBag()->add('success', __('Application ID saved'));
34
            $model->make();
35
        }
36
37
        return $this->view->render('main/yandex_connect', [
38
            'model' => $model
39
        ]);
40
    }
41
}