KeysController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 10
c 1
b 0
f 1
dl 0
loc 19
rs 10
ccs 10
cts 10
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 14 2
1
<?php
2
3
namespace ByTIC\Hello\Modules\Oauth\Controllers;
4
5
use League\OAuth2\Server\CryptKey;
6
use Nip\Container\Container;
7
use Nip\Controllers\Controller;
8
use Nip\Http\Response\JsonResponse;
9
10
/**
11
 * Class KeysController
12
 * @package ByTIC\Hello\Modules\Oauth\Controllers
13
 */
14
class KeysController extends Controller
15
{
16
    /**
17
     * @return JsonResponse
18
     */
19 1
    public function index()
20
    {
21 1
        $container = function_exists('app') ? app() : Container::getInstance();
22
        /** @var CryptKey $publicKey */
23 1
        $publicKey = $container->get('hello.keys.public');
24
25 1
        $key = new \stdClass();
26 1
        $key->alg = "RS256";
27 1
        $key->kty = "RSA";
28 1
        $key->use = "sig";
29 1
        $key->x5c = [file_get_contents($publicKey->getKeyPath())];
30 1
        $data = ['keys' => [$key]];
31
32 1
        return new JsonResponse($data);
33
    }
34
}
35