Failed Conditions
Push — master ( 425621...cb7620 )
by Florent
02:38
created

Controller/JWKSetController.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2016 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace SpomkyLabs\JoseBundle\Controller;
13
14
use Jose\Object\JWKSetInterface;
15
use Symfony\Component\HttpFoundation\Response;
16
17
final class JWKSetController
18
{
19
    /**
20
     * @var \Jose\Object\JWKSetInterface
21
     */
22
    private $jwkset;
23
24
    /**
25
     * JWKSetController constructor.
26
     *
27
     * @param \Jose\Object\JWKSetInterface $jwkset
28
     */
29
    public function __construct(JWKSetInterface $jwkset)
30
    {
31
        $this->jwkset = $jwkset;
32
    }
33
34
    /**
35
     * @return \Symfony\Component\HttpFoundation\Response
36
     */
37
    public function jsonAction()
38
    {
39
        return new Response(json_encode($this->jwkset), Response::HTTP_OK, ['content-type' => 'application/jwk-set+json']);
40
    }
41
42
    /**
43
     * @return \Symfony\Component\HttpFoundation\Response
44
     */
45
    public function pemAction()
46
    {
47
        return new Response(json_encode($this->jwkset->toPEM()), Response::HTTP_OK, ['content-type' => 'application/json']);
0 ignored issues
show
The method toPEM() does not seem to exist on object<Jose\Object\JWKSetInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
48
    }
49
}
50