Issues (1783)

src/variables/RetourVariable.php (19 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\variables;
13
14
use nystudio107\pluginvite\variables\ViteVariableInterface;
15
use nystudio107\pluginvite\variables\ViteVariableTrait;
16
use nystudio107\retour\Retour;
17
18
/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
19
 * @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...
20
 * @package   Retour
0 ignored issues
show
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
21
 * @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...
22
 */
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...
23
class RetourVariable implements ViteVariableInterface
24
{
25
    use ViteVariableTrait;
26
27
    // Public Methods
28
    // =========================================================================
29
30
    /**
31
     * Returns the list of matching schemes
32
     *
33
     * @return array
34
     */
35
    public function getMatchesList(): array
36
    {
37
        return Retour::$plugin->redirects->getMatchesList();
0 ignored issues
show
The method getMatchesList() 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

37
        return Retour::$plugin->redirects->/** @scrutinizer ignore-call */ getMatchesList();

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...
38
    }
39
40
    /**
41
     * Return the http status code
42
     *
43
     * @return int
44
     */
45
    public function getHttpStatus(): int
46
    {
47
        return http_response_code();
0 ignored issues
show
Bug Best Practice introduced by
The expression return http_response_code() could return the type true which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
48
    }
49
50
    /**
51
     * Return whether we are running Craft 3.1 or later
52
     *
53
     * @return bool
54
     */
55
    public function craft31(): bool
56
    {
57
        return true;
58
    }
59
60
    /**
61
     * Return whether we are running Craft 3.2 or later
62
     *
63
     * @return bool
64
     */
65
    public function craft32(): bool
66
    {
67
        return true;
68
    }
69
}
70