Test Failed
Push — master ( a6b51e...5fffdb )
by Gabriel
08:05
created

KeysController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
ccs 10
cts 10
cp 1
wmc 2
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 15 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