Issues (37)

src/Provider/ProviderInterface.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Parroauth2\Client\Provider;
4
5
use Jose\Component\Core\JWKSet;
6
use Parroauth2\Client\ClientConfig;
7
use Parroauth2\Client\ClientInterface;
8
use Parroauth2\Client\Exception\Parroauth2Exception;
9
use Parroauth2\Client\Exception\UnsupportedServerOperation;
10
use Psr\Http\Client\ClientInterface as PsrClientInterface;
11
use Psr\Http\Message\RequestInterface;
12
use Psr\Http\Message\ResponseInterface;
13
use Psr\Http\Message\StreamInterface;
14
15
/**
16
 * The authorization provider
17
 *
18
 * Handle the HTTP operations, and create clients
19
 */
20
interface ProviderInterface extends PsrClientInterface
21
{
22
    /**
23
     * Check if the provider supports OpenID Connect
24
     *
25
     * @return bool
26
     */
27
    public function openid(): bool;
28
29
    /**
30
     * Get the issuer value for the provider
31
     * The issuer is the base URL of the provider
32
     *
33
     * @return string
34
     */
35
    public function issuer(): string;
36
37
    /**
38
     * Get a server metadata parameter
39
     *
40
     * @param string $parameter The parameter name
41
     * @param T|null $default Default value to return if the parameter is not found
0 ignored issues
show
The type Parroauth2\Client\Provider\T was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
     *
43
     * @return T|null The parameter value
44
     * @psalm-return ($default is null ? mixed|null : T)
45
     *
46
     * @template T
47
     */
48
    public function metadata(string $parameter, $default = null);
49
50
    /**
51
     * Check if the provider supports the given endpoint
52
     *
53
     * @param string $name The endpoint name
54
     *
55
     * @return bool
56
     */
57
    public function supportsEndpoint(string $name): bool;
58
59
    /**
60
     * Generates the URI for an endpoint
61
     *
62
     * @param string $name The endpoint name
63
     * @param array $queryParameters The query parameters
64
     *
65
     * @return string
66
     * @throws UnsupportedServerOperation When the server is not configured for supports the endpoint
67
     */
68
    public function uri(string $name, array $queryParameters = []): string;
69
70
    /**
71
     * Creates a new http request
72
     *
73
     * @param string $method The HTTP method
74
     * @param string $endpoint The endpoint name
75
     * @param array $queryParameters The query parameters
76
     * @param resource|string|StreamInterface|array|object|null $body The body
77
     *
78
     * @return RequestInterface
79
     * @throws UnsupportedServerOperation
80
     */
81
    public function request(string $method, string $endpoint, array $queryParameters = [], $body = null): RequestInterface;
82
83
    /**
84
     * {@inheritdoc}
85
     *
86
     * @throws Parroauth2Exception When a server error occurs
87
     */
88
    public function sendRequest(RequestInterface $request): ResponseInterface;
89
90
    /**
91
     * Creates a client for the provider
92
     *
93
     * @param ClientConfig $config
94
     *
95
     * @return ClientInterface
96
     */
97
    public function client(ClientConfig $config): ClientInterface;
98
99
    /**
100
     * Get the keyset (jwks) of the provider
101
     *
102
     * @return JWKSet
103
     *
104
     * @throws Parroauth2Exception When a server error occurs
105
     * @throws \Http\Client\Exception
106
     *
107
     * @psalm-suppress InvalidThrow
108
     */
109
    public function keySet(): JWKSet;
110
}
111