Passed
Push — main ( a1592b...fca0b2 )
by Nobufumi
03:02
created

HelpController::showHelpMarkdown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 7
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 10
rs 10
1
<?php
2
3
namespace Jidaikobo\Kontiki\Controllers;
4
5
use Slim\App;
6
use Psr\Http\Message\ResponseInterface as Response;
7
use Psr\Http\Message\ServerRequestInterface as Request;
8
9
class HelpController extends BaseController
10
{
11
    public static function registerRoutes(App $app, string $basePath = ''): void
12
    {
13
        $app->get('/help', HelpController::class . ':showHelp');
14
        $app->get('/help/markdown', HelpController::class . ':showHelpMarkdown');
15
    }
16
17
    /**
18
     * help
19
     *
20
     * @return Response
21
     */
22
    public function showHelp(Request $request, Response $response): Response
23
    {
24
        ob_start();
25
        require(__DIR__ . '/../locale/' . env('APPLANG') . '/file/help.php');
26
        $content = ob_get_clean();
27
28
        return $this->renderResponse(
29
            $response,
30
            __('help'),
31
            $content,
32
            'layout-help.php'
33
        );
34
    }
35
36
    /**
37
     * show help of Markdown
38
     *
39
     * @return Response
40
     */
41
    public function showHelpMarkdown(Request $request, Response $response): Response
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

41
    public function showHelpMarkdown(/** @scrutinizer ignore-unused */ Request $request, Response $response): Response

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        $helpText = __DIR__ . '/../locale/' . env('APPLANG') . '/file/markdown-help.php';
44
        $content = file_get_contents($helpText);
45
46
        return $this->renderResponse(
47
            $response,
48
            __("markdown_help", 'Markdown Help'),
49
            $content,
50
            'layout-help.php'
51
        );
52
    }
53
}
54