MdToHtml   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
eloc 8
c 2
b 0
f 0
dl 0
loc 31
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 29 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Koriym\AppStateDiagram;
6
7
use Michelf\MarkdownExtra;
8
9
final class MdToHtml
10
{
11
    public function __invoke(string $title, string $markdown): string
12
    {
13
        $htmlDiv = MarkdownExtra::defaultTransform($markdown);
14
15
        return /** @lang HTML */<<<EOT
16
<html lang="en">
17
<head>
18
    <title>{$title}</title>
19
    <meta charset="UTF-8">
20
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/3.0.1/github-markdown.min.css">
21
    <style>
22
        .markdown-body {
23
            box-sizing: border-box;
24
            min-width: 200px;
25
            max-width: 980px;
26
            margin: 0 auto;
27
            padding: 25px;
28
        }
29
    
30
        @media (max-width: 767px) {
31
            .markdown-body {
32
                padding: 15px;
33
            }
34
        }
35
    </style>
36
</head>
37
<body>
38
    <div class="markdown-body">
39
        {$htmlDiv}
40
    </div>
41
</body>
42
</html>
43
EOT;
44
    }
45
}
46