VanillaforumsVariable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
c 2
b 0
f 0
dl 0
loc 27
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A embeddedOutput() 0 4 1
A craft31() 0 3 1
1
<?php
2
/**
3
 * Vanillaforums plugin for Craft CMS 3.x
4
 *
5
 * Single Sign On plugin for VanillaForums/jsConnect and CraftCMS
6
 *
7
 * @link      https://nystudio107.com/
8
 * @copyright Copyright (c) 2019 nystudio107
9
 */
10
11
namespace nystudio107\vanillaforums\variables;
12
13
use nystudio107\vanillaforums\Vanillaforums;
14
15
use craft\helpers\Template;
16
17
/**
18
 * @author    nystudio107
19
 * @package   Vanillaforums
20
 * @since     3.0.0
21
 */
22
class VanillaforumsVariable
23
{
24
    // Public Methods
25
    // =========================================================================
26
27
    /**
28
     * Generate an SSO string suitable for passing in the url for embedded SSO
29
     *
30
     * @param int $userId
31
     *
32
     * @return string
33
     */
34
    public function embeddedOutput(int $userId = 0): string
35
    {
36
        return Template::raw(
37
            Vanillaforums::$plugin->sso->embeddedOutput($userId)
38
        );
39
    }
40
41
    /**
42
     * Return whether we are running Craft 3.1 or later
43
     *
44
     * @return bool
45
     */
46
    public function craft31(): bool
47
    {
48
        return Vanillaforums::$craft31;
49
    }
50
}
51