Issues (1783)

src/console/controllers/StatsController.php (26 issues)

1
<?php
2
/**
3
 * Retour plugin for Craft CMS
4
 *
5
 * Retour allows you to intelligently redirect legacy URLs, so that you don't
6
 * lose SEO value when rebuilding & restructuring a website
7
 *
8
 * @link      https://nystudio107.com/
0 ignored issues
show
The tag in position 1 should be the @copyright tag
Loading history...
9
 * @copyright Copyright (c) 2018 nystudio107
0 ignored issues
show
@copyright tag must contain a year and the name of the copyright holder
Loading history...
10
 */
0 ignored issues
show
PHP version not specified
Loading history...
Missing @category tag in file comment
Loading history...
Missing @package tag in file comment
Loading history...
Missing @author tag in file comment
Loading history...
Missing @license tag in file comment
Loading history...
11
12
namespace nystudio107\retour\console\controllers;
13
14
use Craft;
15
use nystudio107\retour\Retour;
16
use yii\console\Controller;
17
18
/**
19
 * Retour Stats command
20
 *
21
 * @author    nystudio107
0 ignored issues
show
The tag in position 1 should be the @package tag
Loading history...
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
Tag value for @author tag indented incorrectly; expected 2 spaces but found 4
Loading history...
22
 * @package   Retour
0 ignored issues
show
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
23
 * @since     3.0.0
0 ignored issues
show
The tag in position 3 should be the @author tag
Loading history...
Tag value for @since tag indented incorrectly; expected 3 spaces but found 5
Loading history...
24
 */
0 ignored issues
show
Missing @category tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
25
class StatsController extends Controller
26
{
27
    // Public Properties
28
    // =========================================================================
29
30
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
31
     * @var null|int
32
     */
33
    public ?int $limit = null;
34
35
    // Protected Properties
36
    // =========================================================================
37
38
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
39
     * @var    array|bool
0 ignored issues
show
Tag value for @var tag indented incorrectly; expected 1 spaces but found 4
Loading history...
40
     */
41
    protected array|bool $allowAnonymous = [
42
    ];
43
44
    // Public Methods
45
    // =========================================================================
46
47
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
48
     * @param string $actionID
0 ignored issues
show
Missing parameter comment
Loading history...
49
     *
50
     * @return array
51
     */
52
    public function options($actionID): array
53
    {
54
        return [
55
            'limit',
56
        ];
57
    }
58
59
    /**
60
     * Trim the Retour statistics database table
61
     *
62
     * @return int
63
     */
64
    public function actionTrim(): int
65
    {
66
        echo Craft::t('retour', 'Trimming statistics') . PHP_EOL;
67
        $affectedRows = Retour::$plugin->statistics->trimStatistics($this->limit);
0 ignored issues
show
The method trimStatistics() does not exist on null. ( Ignorable by Annotation )

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

67
        /** @scrutinizer ignore-call */ 
68
        $affectedRows = Retour::$plugin->statistics->trimStatistics($this->limit);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
68
        echo Craft::t(
69
                'retour',
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 16.
Loading history...
70
                'Trimmed {rows} from retour_stats table',
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 16.
Loading history...
71
                ['rows' => $affectedRows]
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 16.
Loading history...
72
            ) . PHP_EOL;
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 8 spaces, but found 12.
Loading history...
73
74
        return 0;
75
    }
76
77
    // Protected Methods
78
    // =========================================================================
79
}
80