DisqusVariable::disqusEmbed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 1
Metric Value
cc 1
eloc 7
c 4
b 0
f 1
nc 1
nop 6
dl 0
loc 15
rs 10
1
<?php
2
/**
3
 * Disqus plugin for Craft CMS 3.x
4
 *
5
 * Integrates the Disqus commenting system into Craft 3 websites, including
6
 * Single Sign On (SSO) and custom login/logout URLs
7
 *
8
 * @link      https://nystudio107.com
0 ignored issues
show
Coding Style introduced by
The tag in position 1 should be the @copyright tag
Loading history...
9
 * @copyright Copyright (c) 2017 nystudio107
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
10
 */
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...
11
12
namespace nystudio107\disqus\variables;
13
14
use nystudio107\disqus\Disqus;
15
use Twig\Markup;
16
17
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
18
 * @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...
19
 * @package   Disqus
0 ignored issues
show
Coding Style introduced by
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
20
 * @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...
21
 */
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...
22
class DisqusVariable
23
{
24
    // Public Methods
25
    // =========================================================================
26
27
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
28
     * @param string $disqusIdentifier
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
29
     * @param string $disqusTitle
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
30
     * @param string $disqusUrl
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
31
     * @param string $disqusCategoryId
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
32
     * @param string $disqusLanguage
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
33
     * @param array $scriptAttributes
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
34
     *
35
     * @return Markup
36
     */
37
    public function disqusEmbed(
38
        string $disqusIdentifier = "",
39
        string $disqusTitle = "",
40
        string $disqusUrl = "",
41
        string $disqusCategoryId = "",
42
        string $disqusLanguage = "",
43
        array  $scriptAttributes = [],
44
    ): Markup {
45
        return Disqus::$plugin->disqusService->outputEmbedTag(
46
            $disqusIdentifier,
47
            $disqusTitle,
48
            $disqusUrl,
49
            $disqusCategoryId,
50
            $disqusLanguage,
51
            $scriptAttributes
52
        );
53
    }
54
55
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
56
     * @param string $disqusIdentifier
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
57
     *
58
     * @return int
59
     */
60
    public function disqusCount(
61
        string $disqusIdentifier = "",
62
    ): int {
63
        return Disqus::$plugin->disqusService->getCommentsCount(
64
            $disqusIdentifier
65
        );
66
    }
67
68
    /**
69
     * Return whether we are running Craft 3.1 or later
70
     *
71
     * @return bool
72
     */
73
    public function craft31(): bool
74
    {
75
        return true;
76
    }
77
}
78