Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
46.67% |
7 / 15 |
|
50.00% |
5 / 10 |
|
50.00% |
5 / 10 |
|
55.56% |
5 / 9 |
CRAP | |
0.00% |
0 / 1 |
| PhpOutput | |
46.67% |
7 / 15 |
|
50.00% |
5 / 10 |
|
50.00% |
5 / 10 |
|
55.56% |
5 / 9 |
22.50 | |
0.00% |
0 / 1 |
| output | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| style | n/a |
0 / 0 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
n/a |
0 / 0 |
1 | |||||
| top | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| bottom | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| title | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| line | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| erreur | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| ok | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| ko | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| filter | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Service\ApplicationInfo\Output; |
| 4 | |
| 5 | class PhpOutput implements InterfaceOutput |
| 6 | { |
| 7 | public function output(string $str): void |
| 8 | { |
| 9 | printf('%s', $str); |
| 10 | } |
| 11 | |
| 12 | public function style(): string |
| 13 | { |
| 14 | return <<<EOT |
| 15 | <style> |
| 16 | h1, h2, h3, h4, h5, h6 { |
| 17 | margin-top: 0; |
| 18 | margin-bottom: 0.5rem; |
| 19 | } |
| 20 | |
| 21 | body { |
| 22 | font-family: system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, serif; |
| 23 | font-size: 1rem; |
| 24 | font-weight: normal; |
| 25 | line-height: 1.5; |
| 26 | color: #292b2c; |
| 27 | background-color: #fff; |
| 28 | } |
| 29 | |
| 30 | .warning { |
| 31 | background-color: #f2dede; |
| 32 | color: #a94442; |
| 33 | padding: 0.1rem 0.1rem; |
| 34 | margin-bottom: 1rem; |
| 35 | border: 1px solid #ebcccc; |
| 36 | border-radius: 0.25rem; |
| 37 | } |
| 38 | |
| 39 | .green { |
| 40 | background-color: #dff0d8; |
| 41 | color: #3c763d; |
| 42 | padding: 0.1rem 0.1rem; |
| 43 | margin-bottom: 1rem; |
| 44 | border: 1px solid #d0e9c6; |
| 45 | border-radius: 0.25rem; |
| 46 | } |
| 47 | </style> |
| 48 | EOT; |
| 49 | } |
| 50 | |
| 51 | public function top(): void |
| 52 | { |
| 53 | $top = <<<EOT |
| 54 | <!DOCTYPE html> |
| 55 | <html lang="fr"> |
| 56 | <head> |
| 57 | <meta http-equiv="X-UA-Compatible" content="IE=edge"/> |
| 58 | <title>ApplicationInfo</title> |
| 59 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
| 60 | {$this->style()} |
| 61 | </head> |
| 62 | <body> |
| 63 | EOT; |
| 64 | $this->output($top); |
| 65 | } |
| 66 | |
| 67 | public function bottom(): void |
| 68 | { |
| 69 | $bottom = <<<EOT |
| 70 | <br/> |
| 71 | </body> |
| 72 | </html> |
| 73 | EOT; |
| 74 | $this->output($bottom); |
| 75 | } |
| 76 | |
| 77 | public function title(string $str): void |
| 78 | { |
| 79 | $this->output('<h2>' . $str . '</h2>'); |
| 80 | } |
| 81 | |
| 82 | public function line(string $str): void |
| 83 | { |
| 84 | $this->output($str . '</br>'); |
| 85 | } |
| 86 | |
| 87 | public function erreur(string $str): void |
| 88 | { |
| 89 | $this->line('Erreur : ' . $this->ko($str)); |
| 90 | } |
| 91 | |
| 92 | public function ok(string $str): string |
| 93 | { |
| 94 | return '<span class="green">' . $str . '</span>'; |
| 95 | } |
| 96 | |
| 97 | public function ko(string $str): string |
| 98 | { |
| 99 | return '<span class="warning">' . $str . '</span>'; |
| 100 | } |
| 101 | |
| 102 | public function filter(string $str): string |
| 103 | { |
| 104 | return htmlentities($str, ENT_QUOTES, 'UTF-8'); |
| 105 | } |
| 106 | } |