YoutubeLiveEmbedVariable::isLive()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * YouTube Live Embed plugin for Craft CMS
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
use Twig\Markup;
15
16
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
17
 * @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...
18
 * @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...
19
 * @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...
20
 */
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...
21
class YoutubeLiveEmbedVariable
22
{
23
    // Public Methods
24
    // =========================================================================
25
26
    /**
27
     * Renders the responsive iframe for the live stream video
28
     *
29
     * @param int $aspectRatioX
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
30
     * @param int $aspectRatioY
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
31
     *
32
     * @return Markup
33
     */
34
    public function embedStream(int $aspectRatioX = 16, int $aspectRatioY = 9): Markup
35
    {
36
        return YoutubeLiveEmbed::$plugin->embed->embedStream($aspectRatioX, $aspectRatioY);
37
    }
38
39
    /**
40
     * Renders the responsive Google AMP iframe for the live stream video
41
     *
42
     * @param int $aspectRatioX
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
43
     * @param int $aspectRatioY
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
44
     *
45
     * @return Markup
46
     */
47
    public function embedStreamAmp(int $aspectRatioX = 16, int $aspectRatioY = 9): Markup
48
    {
49
        return YoutubeLiveEmbed::$plugin->embed->embedStreamAmp($aspectRatioX, $aspectRatioY);
50
    }
51
52
    /**
53
     * Renders the responsive iframe HTML for the live stream chat
54
     *
55
     * @param int $aspectRatioX
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
56
     * @param int $aspectRatioY
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
57
     *
58
     * @return Markup
59
     */
60
    public function embedChat(int $aspectRatioX = 16, int $aspectRatioY = 9): Markup
61
    {
62
        return YoutubeLiveEmbed::$plugin->embed->embedChat($aspectRatioX, $aspectRatioY);
63
    }
64
65
    /**
66
     * Renders the responsive Google AMP iframe HTML for the live stream chat
67
     *
68
     * @param int $aspectRatioX
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
69
     * @param int $aspectRatioY
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
70
     *
71
     * @return Markup
72
     */
73
    public function embedChatAmp(int $aspectRatioX = 16, int $aspectRatioY = 9): Markup
74
    {
75
        return YoutubeLiveEmbed::$plugin->embed->embedChatAmp($aspectRatioX, $aspectRatioY);
76
    }
77
78
    /**
79
     * Sets the YouTube Channel ID to $channelId
80
     *
81
     * @param string $channelId
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
82
     *
83
     * @return string
84
     */
85
    public function setChannelId(string $channelId): string
86
    {
87
        YoutubeLiveEmbed::$plugin->embed->setChannelId($channelId);
88
89
        return '';
90
    }
91
92
    /**
93
     * Returns whether the stream is currently live
94
     *
95
     * @return bool
96
     */
97
    public function isLive(): bool
98
    {
99
        return YoutubeLiveEmbed::$plugin->embed->isLive();
100
    }
101
}
102