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
Coding Style
introduced
by
![]() |
|||||||
9 | * @copyright Copyright (c) 2018 nystudio107 |
||||||
0 ignored issues
–
show
|
|||||||
10 | */ |
||||||
0 ignored issues
–
show
|
|||||||
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
Content of the @author tag must be in the form "Display Name <[email protected]>"
![]() |
|||||||
22 | * @package Retour |
||||||
0 ignored issues
–
show
|
|||||||
23 | * @since 3.0.0 |
||||||
0 ignored issues
–
show
|
|||||||
24 | */ |
||||||
0 ignored issues
–
show
|
|||||||
25 | class StatsController extends Controller |
||||||
26 | { |
||||||
27 | // Public Properties |
||||||
28 | // ========================================================================= |
||||||
29 | |||||||
30 | /** |
||||||
0 ignored issues
–
show
|
|||||||
31 | * @var null|int |
||||||
32 | */ |
||||||
33 | public ?int $limit = null; |
||||||
34 | |||||||
35 | // Protected Properties |
||||||
36 | // ========================================================================= |
||||||
37 | |||||||
38 | /** |
||||||
0 ignored issues
–
show
|
|||||||
39 | * @var array|bool |
||||||
0 ignored issues
–
show
|
|||||||
40 | */ |
||||||
41 | protected array|bool $allowAnonymous = [ |
||||||
42 | ]; |
||||||
43 | |||||||
44 | // Public Methods |
||||||
45 | // ========================================================================= |
||||||
46 | |||||||
47 | /** |
||||||
0 ignored issues
–
show
|
|||||||
48 | * @param string $actionID |
||||||
0 ignored issues
–
show
|
|||||||
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
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. ![]() |
|||||||
68 | echo Craft::t( |
||||||
69 | 'retour', |
||||||
0 ignored issues
–
show
|
|||||||
70 | 'Trimmed {rows} from retour_stats table', |
||||||
0 ignored issues
–
show
|
|||||||
71 | ['rows' => $affectedRows] |
||||||
0 ignored issues
–
show
|
|||||||
72 | ) . PHP_EOL; |
||||||
0 ignored issues
–
show
|
|||||||
73 | |||||||
74 | return 0; |
||||||
75 | } |
||||||
76 | |||||||
77 | // Protected Methods |
||||||
78 | // ========================================================================= |
||||||
79 | } |
||||||
80 |