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

src/controllers/ManifestController.php (1 issue)

Checks file comment missing version

Coding Style Informational
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
8
 * @copyright Copyright (c) 2017 nystudio107
9
 */
0 ignored issues
show
PHP version not specified
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
/**
19
 * @author    nystudio107
20
 * @package   Transcode
21
 * @since     1.0.0
22
 */
23
class ManifestController extends Controller
24
{
25
    // Constants
26
    // =========================================================================
27
28
    // Protected Properties
29
    // =========================================================================
30
31
    /**
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
47
     * @param string $fileName
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
56
        );
57
        $url = "{$baseAssetsUrl}/{$resourceType}/{$fileName}";
58
59
        return $this->redirect($url);
60
    }
61
}
62