Passed
Push — v1 ( 0eb06a...5afc0b )
by Andrew
09:35 queued 05:38
created

YoutubeLiveEmbedVariable::liveViewers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * YouTube Live Embed plugin for Craft CMS 3.x
4
 *
5
 * This plugin allows you to embed a YouTube live stream and/or live chat on your webpage
6
 *
7
 * @link      https://nystudio107.com
0 ignored issues
show
Coding Style introduced by
The tag in position 1 should be the @copyright tag
Loading history...
8
 * @copyright Copyright (c) 2019 nystudio107
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
9
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
10
11
namespace nystudio107\youtubeliveembed\variables;
12
13
use nystudio107\youtubeliveembed\YoutubeLiveEmbed;
14
15
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
16
 * @author    nystudio107
0 ignored issues
show
Coding Style introduced by
The tag in position 1 should be the @package tag
Loading history...
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
Coding Style introduced by
Tag value for @author tag indented incorrectly; expected 2 spaces but found 4
Loading history...
17
 * @package   YoutubeLiveEmbed
0 ignored issues
show
Coding Style introduced by
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
18
 * @since     1.0.0
0 ignored issues
show
Coding Style introduced by
The tag in position 3 should be the @author tag
Loading history...
Coding Style introduced by
Tag value for @since tag indented incorrectly; expected 3 spaces but found 5
Loading history...
19
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
20
class YoutubeLiveEmbedVariable
21
{
22
    // Public Methods
23
    // =========================================================================
24
25
    /**
26
     * Renders the responsive iframe for the live stream video
27
     *
28
     * @param int $aspectRatioX
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
29
     * @param int $aspectRatioY
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
30
     *
31
     * @return \Twig_Markup
32
     */
33
    public function embedStream(int $aspectRatioX = 16, int $aspectRatioY = 9): \Twig_Markup
34
    {
35
        return YoutubeLiveEmbed::$plugin->embed->embedStream($aspectRatioX, $aspectRatioY);
36
    }
37
38
    /**
39
     * Renders the responsive Google AMP iframe for the live stream video
40
     *
41
     * @param int $aspectRatioX
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
42
     * @param int $aspectRatioY
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
43
     *
44
     * @return \Twig_Markup
45
     */
46
    public function embedStreamAmp(int $aspectRatioX = 16, int $aspectRatioY = 9): \Twig_Markup
47
    {
48
        return YoutubeLiveEmbed::$plugin->embed->embedStreamAmp($aspectRatioX, $aspectRatioY);
49
    }
50
51
    /**
52
     * Renders the responsive iframe HTML for the live stream chat
53
     *
54
     * @param int $aspectRatioX
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
55
     * @param int $aspectRatioY
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
56
     *
57
     * @return \Twig_Markup
58
     */
59
    public function embedChat(int $aspectRatioX = 16, int $aspectRatioY = 9): \Twig_Markup
60
    {
61
        return YoutubeLiveEmbed::$plugin->embed->embedChat($aspectRatioX, $aspectRatioY);
62
    }
63
64
    /**
65
     * Renders the responsive Google AMP iframe HTML for the live stream chat
66
     *
67
     * @param int $aspectRatioX
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
68
     * @param int $aspectRatioY
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
69
     *
70
     * @return \Twig_Markup
71
     */
72
    public function embedChatAmp(int $aspectRatioX = 16, int $aspectRatioY = 9): \Twig_Markup
73
    {
74
        return YoutubeLiveEmbed::$plugin->embed->embedChatAmp($aspectRatioX, $aspectRatioY);
75
    }
76
77
    /**
78
     * Sets the YouTube Channel ID to $channelId
79
     *
80
     * @param string $channelId
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
81
     *
82
     * @return string
83
     */
84
    public function setChannelId(string $channelId): string
85
    {
86
        YoutubeLiveEmbed::$plugin->embed->setChannelId($channelId);
87
88
        return '';
89
    }
90
91
    /**
92
     * Returns whether the stream is currently live
93
     *
94
     * @return bool
95
     */
96
    public function isLive(): bool
97
    {
98
        return YoutubeLiveEmbed::$plugin->embed->isLive();
99
    }
100
}
101