Passed
Push — v1 ( c4e279...3fd45a )
by Andrew
16:46 queued 09:49
created

src/controllers/ManifestController.php (21 issues)

1
<?php
2
/**
3
 * Transcoder plugin for Craft CMS 3.x
4
 *
5
 * Transcode videos to various formats, and provide thumbnails of the video
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\transcoder\controllers;
12
13
use Craft;
14
use craft\web\Controller;
15
16
use yii\web\Response;
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   Transcode
0 ignored issues
show
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
21
 * @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...
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 ManifestController extends Controller
24
{
25
    // Constants
26
    // =========================================================================
27
28
    // Protected Properties
29
    // =========================================================================
30
31
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
32
     * @var    bool|array Allows anonymous access to this controller's actions.
33
     *         The actions must be in 'kebab-case'
34
     * @access protected
35
     */
36
    protected $allowAnonymous = [
37
        'resource'
38
    ];
39
40
    // Public Methods
41
    // =========================================================================
42
43
    /**
44
     * Make webpack async bundle loading work out of published AssetBundles
45
     *
46
     * @param string $resourceType
0 ignored issues
show
Missing parameter comment
Loading history...
47
     * @param string $fileName
0 ignored issues
show
Missing parameter comment
Loading history...
48
     *
49
     * @return Response
50
     */
51
    public function actionResource(string $resourceType = '', string $fileName = ''): Response
52
    {
53
        $baseAssetsUrl = Craft::$app->assetManager->getPublishedUrl(
54
            '@nystudio107/transcoder/assetbundles/transcoder/dist',
55
            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

55
        /** @scrutinizer ignore-call */ 
56
        $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...
56
        );
57
        $url = "{$baseAssetsUrl}/{$resourceType}/{$fileName}";
58
59
        return $this->redirect($url);
60
    }
61
}
62