Completed
Push — develop ( 752c7f...4a7063 )
by Tino
05:54
created

Newsletter/Controller/Admin/Accounts/Activate.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * Copyright (c) by the ACP3 Developers.
5
 * See the LICENSE file at the top-level module directory for licensing details.
6
 */
7
8
namespace ACP3\Modules\ACP3\Newsletter\Controller\Admin\Accounts;
9
10
use ACP3\Core;
11
use ACP3\Modules\ACP3\Newsletter;
12
13
class Activate extends Core\Controller\AbstractFormAction
14
{
15
    /**
16
     * @var \ACP3\Modules\ACP3\Newsletter\Helper\AccountStatus
17
     */
18
    protected $accountStatusHelper;
19
20
    public function __construct(
21
        Core\Controller\Context\FormContext $context,
22
        Newsletter\Helper\AccountStatus $accountStatusHelper
23
    ) {
24
        parent::__construct($context);
25
26
        $this->accountStatusHelper = $accountStatusHelper;
27
    }
28
29
    /**
30
     * @param int $id
31
     *
32
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
33
     */
34
    public function execute(int $id)
35
    {
36
        $bool = $this->accountStatusHelper->changeAccountStatus(
37
            Newsletter\Helper\AccountStatus::ACCOUNT_STATUS_CONFIRMED,
38
            $id
39
        );
40
41
        return $this->redirectMessages()->setMessage(
42
            $bool,
0 ignored issues
show
$bool of type integer is incompatible with the type boolean expected by parameter $isSuccess of ACP3\Core\Helpers\RedirectMessages::setMessage(). ( Ignorable by Annotation )

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

42
            /** @scrutinizer ignore-type */ $bool,
Loading history...
43
            $this->translator->t('newsletter', $bool !== false ? 'activate_success' : 'activate_error')
44
        );
45
    }
46
}
47