Completed
Push — master ( a0021a...b62e87 )
by claudio
14:16 queued 08:46
created

NoAuthController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace plunner\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use plunner\Http\Requests;
7
use plunner\Meeting;
8
9
class NoAuthController extends Controller
10
{
11
    public function __construct()
12
    {
13
    }
14
15
16
    //TODO remove this, it is just a tmp fix
17
    /**
18
     *
19
     * Store a newly created resource in storage.
20
     *
21
     * @param int $meetingId
22
     * @return static
23
     */
24
    public function showImage($meetingId)
25
    {
26
        $meeting = Meeting::findOrFail($meetingId);
27
        //$this->authorize($meeting);
28
        $ret = self::getImg($meeting);
29
        $blank = storage_path('img/meetings.jpg');
30
        if ($ret === false)
31
            return (new Response(file_get_contents($blank), 200))
32
                ->header('Content-Type', 'image/jpeg');
33
        return (new Response($ret, 200))
34
            ->header('Content-Type', 'image/jpeg');
35
    }
36
37
    private static function getImg(Meeting $meeting)
38
    {
39
        $name = 'meetings/' . $meeting->id;
40
        if (!\Storage::exists($name))
0 ignored issues
show
Bug introduced by
The method exists() does not seem to exist on object<Illuminate\Contracts\Filesystem\Factory>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
            return false;
42
        return \Storage::get($name);
43
    }
44
}
45