Issues (587)

src/controllers/ManifestController.php (21 issues)

1
<?php
2
/**
3
 * Instant Analytics plugin for Craft CMS
4
 *
5
 * Instant Analytics brings full Google Analytics support to your Twig templates
6
 *
7
 * @link      https://nystudio107.com
0 ignored issues
show
The tag in position 1 should be the @copyright tag
Loading history...
8
 * @copyright Copyright (c) 2017 nystudio107
0 ignored issues
show
@copyright tag must contain a year and the name of the copyright holder
Loading history...
9
 */
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...
10
11
namespace nystudio107\instantanalytics\controllers;
12
13
use Craft;
14
use craft\web\Controller;
15
use yii\web\Response;
16
17
/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
18
 * @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...
19
 * @package   InstantAnalytics
0 ignored issues
show
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
20
 * @since     1.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...
21
 */
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...
22
class ManifestController extends Controller
23
{
24
    // Constants
25
    // =========================================================================
26
27
    // Protected Properties
28
    // =========================================================================
29
30
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
31
     * @var    bool|array Allows anonymous access to this controller's actions.
32
     *         The actions must be in 'kebab-case'
33
     * @access protected
34
     */
35
    protected $allowAnonymous = [
36
        'resource'
37
    ];
38
39
    // Public Methods
40
    // =========================================================================
41
42
    /**
43
     * Make webpack async bundle loading work out of published AssetBundles
44
     *
45
     * @param string $resourceType
0 ignored issues
show
Missing parameter comment
Loading history...
46
     * @param string $fileName
0 ignored issues
show
Missing parameter comment
Loading history...
47
     *
48
     * @return Response
49
     */
50
    public function actionResource(string $resourceType = '', string $fileName = ''): Response
51
    {
52
        $baseAssetsUrl = Craft::$app->assetManager->getPublishedUrl(
53
            '@nystudio107/instantanalytics/assetbundles/instantanalytics/dist',
54
            true
0 ignored issues
show
The call to yii\web\AssetManager::getPublishedUrl() has too many arguments starting with true. ( Ignorable by Annotation )

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

54
        /** @scrutinizer ignore-call */ 
55
        $baseAssetsUrl = Craft::$app->assetManager->getPublishedUrl(

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
55
        );
56
        $url = "{$baseAssetsUrl}/{$resourceType}/{$fileName}";
57
58
        return $this->redirect($url);
59
    }
60
}
61