SwaggerConfiguration::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 5
dl 0
loc 10
ccs 1
cts 1
cp 1
crap 1
rs 10
c 2
b 0
f 0
1
<?php
2
3
/**
4
 * It's free open-source software released under the MIT License.
5
 *
6
 * @author Anatoly Nekhay <[email protected]>
7
 * @copyright Copyright (c) 2018, Anatoly Nekhay
8
 * @license https://github.com/sunrise-php/http-router/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/http-router
10
 */
11
12
declare(strict_types=1);
13
14
namespace Sunrise\Http\Router\OpenApi;
15
16
use Sunrise\Http\Router\OpenApi\Controller\OpenApiController;
17
18
/**
19
 * @since 3.0.0
20
 */
21
final class SwaggerConfiguration
22
{
23
    public const DEFAULT_TEMPLATE_FILENAME = __DIR__ . '/../../resources/templates/swagger.phtml';
24
25
    public const DEFAULT_CSS_URLS = [
26
        'https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.18.2/swagger-ui.min.css',
27
    ];
28
29
    public const DEFAULT_JS_URLS = [
30
        'https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.18.2/swagger-ui-bundle.min.js',
31
        'https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.18.2/swagger-ui-standalone-preset.min.js',
32
    ];
33
34
    public const DEFAULT_OPENAPI_URI = OpenApiController::ROUTE_PATH;
35
36 1
    public function __construct(
37
        public readonly string $templateFilename = self::DEFAULT_TEMPLATE_FILENAME,
38
        /** @var array<array-key, string> */
39
        public readonly array $cssUrls = self::DEFAULT_CSS_URLS,
40
        /** @var array<array-key, string> */
41
        public readonly array $jsUrls = self::DEFAULT_JS_URLS,
42
        public readonly string $openapiUri = self::DEFAULT_OPENAPI_URI,
43
        /** @var array<string, mixed> */
44
        public readonly array $templateVariables = [],
45
    ) {
46 1
    }
47
}
48