Issues (6)

src/Http/Controllers/SessionController.php (2 issues)

Severity
1
<?php
2
3
namespace Socialblue\LaravelQueryAdviser\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Routing\Controller;
7
use Socialblue\LaravelQueryAdviser\Service\Session;
8
use Symfony\Component\HttpFoundation\BinaryFileResponse;
9
10
/**
11
 * Class SessionController
12
 * @package Socialblue\LaravelQueryAdviser\Http\Controllers
13
 */
14
class SessionController extends Controller
15
{
16
    /**
17
     * Start a new query log session
18
     */
19
    public function start(): array
20
    {
21
        return Session::start();
22
    }
23
24
    /**
25
     * Stop current query log session
26
     */
27
    public function stop(): array
28
    {
29
        return Session::stop();
30
    }
31
32
    /**
33
     * Get the data of a session
34
     *
35
     * @return mixed
36
     */
37
    public function show(string $sessionKey, Request $request): array
0 ignored issues
show
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

37
    public function show(string $sessionKey, /** @scrutinizer ignore-unused */ Request $request): array

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...
38
    {
39
        return Session::get($sessionKey);
40
    }
41
42
    /**
43
     * Get the status of session
44
     */
45
    public function isActive(): array
46
    {
47
        return Session::status();
48
    }
49
50
    /**
51
     * Export a session
52
     */
53
    public function export(string $sessionKey, Request $request): BinaryFileResponse
0 ignored issues
show
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

53
    public function export(string $sessionKey, /** @scrutinizer ignore-unused */ Request $request): BinaryFileResponse

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...
54
    {
55
        return Session::export($sessionKey);
56
    }
57
58
    /**
59
     * Import a session
60
     */
61
    public function import(Request $request): array
62
    {
63
        $data = json_decode($request->file('session')->getContent() ?? "[]", true);
64
        return Session::import($data);
65
    }
66
67
    /**
68
     * Get the session list
69
     */
70
    public function getList(): array
71
    {
72
        return Session::sessions();
73
    }
74
75
    /**
76
     * Clear session list
77
     */
78
    public function clear(): array
79
    {
80
        return Session::clearList();
81
    }
82
}
83