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

NoAuthController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 2 Features 0
Metric Value
wmc 5
c 2
b 2
f 0
lcom 0
cbo 2
dl 0
loc 36
ccs 0
cts 21
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A showImage() 0 12 2
A getImg() 0 7 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