Passed
Push — develop ( a6a975...49e3f5 )
by Nikolay
04:45 queued 13s
created

ResetLicenseAction::main()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 11
rs 9.9666
cc 1
nc 1
nop 1
1
<?php
2
/*
3
 * MikoPBX - free phone system for small business
4
 * Copyright © 2017-2024 Alexey Portnov and Nikolay Beketov
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License along with this program.
17
 * If not, see <https://www.gnu.org/licenses/>.
18
 */
19
20
namespace MikoPBX\PBXCoreREST\Lib\License;
21
22
use MikoPBX\Common\Models\PbxSettingsConstants;
23
use MikoPBX\Common\Providers\MarketPlaceProvider;
24
use MikoPBX\Core\System\MikoPBXConfig;
25
use MikoPBX\PBXCoreREST\Lib\PBXApiResult;
26
use Phalcon\Di;
27
28
29
/**
30
 * Class ResetLicenseAction
31
 * Reset license key.
32
 *
33
 * @property \MikoPBX\Common\Providers\MarketPlaceProvider license
34
 * @package MikoPBX\PBXCoreREST\Lib\Modules
35
 */
36
class ResetLicenseAction extends \Phalcon\Di\Injectable
37
{
38
    /**
39
     * Reset license key.
40
     *
41
     * @return PBXApiResult An object containing the result of the API call.
42
     */
43
    public static function main(array $data): PBXApiResult
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

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

43
    public static function main(/** @scrutinizer ignore-unused */ array $data): PBXApiResult

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
44
    {
45
        $mikoPBXConfig = new MikoPBXConfig();
46
        $res = new PBXApiResult();
47
        $res->processor = __METHOD__;
48
        $mikoPBXConfig->resetGeneralSettings(PbxSettingsConstants::PBX_LICENSE);
49
        $res->success = true;
50
        $di = Di::getDefault();
51
        $license = $di->get(MarketPlaceProvider::SERVICE_NAME);
52
        $license->changeLicenseKey('');
53
        return $res;
54
    }
55
}