GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PreviewController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 5
dl 0
loc 37
ccs 0
cts 27
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A actionMapping() 0 32 3
1
<?php
2
3
4
namespace flipbox\saml\idp\controllers\cp\view\metadata;
5
6
use flipbox\saml\core\controllers\cp\view\metadata\AbstractPreviewController;
7
use flipbox\saml\idp\Saml;
8
use flipbox\saml\idp\traits\SamlPluginEnsured;
9
use SAML2\Assertion;
10
11
class PreviewController extends AbstractPreviewController
12
{
13
    use SamlPluginEnsured;
14
15
    public function actionMapping()
16
    {
17
        $this->requireAdmin(false);
18
19
        Saml::getInstance()->loadSaml2Container();
20
        $settings = Saml::getInstance()->getSettings();
21
22
        $userId = \Craft::$app->request->getRequiredParam('userId');
23
        $providerId = \Craft::$app->request->getRequiredParam('providerId');
24
25
        $user = \Craft::$app->users->getUserById($userId);
26
        $provider = Saml::getInstance()->getProvider()->find([
27
            'id' => $providerId,
28
        ])->one();
29
30
        if (! $user && ! $provider) {
31
            return $this->asErrorJson('Provider or user is invalid');
32
        }
33
34
        Saml::getInstance()->getResponseAssertion()->setAssertionAttributes(
35
            $user,
36
            $assertion = new Assertion(),
37
            $provider,
38
            $settings
39
        );
40
        $doc = $assertion->toXML()->ownerDocument;
41
        $doc->preserveWhiteSpace = false;
42
        $doc->formatOutput = true;
43
        return $this->asJson([
44
            'xml' => $doc->saveXML(),
45
        ]);
46
    }
47
}
48