Completed
Pull Request — master (#16)
by Graham
08:55
created
app/Handlers/Events/UpdateStatistics.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
 
8 8
 class UpdateStatistics
9 9
 {
10
-    /**
11
-     * Handle the event.
12
-     *
13
-     * @param ServerWasPoked $event
14
-     *
15
-     * @return void
16
-     */
17
-    public function handle(ServerWasPoked $event)
18
-    {
19
-        Poke::create($event->getDevice()->toArray());
20
-    }
10
+	/**
11
+	 * Handle the event.
12
+	 *
13
+	 * @param ServerWasPoked $event
14
+	 *
15
+	 * @return void
16
+	 */
17
+	public function handle(ServerWasPoked $event)
18
+	{
19
+		Poke::create($event->getDevice()->toArray());
20
+	}
21 21
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Api/ApiController.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -7,102 +7,102 @@
 block discarded – undo
7 7
 
8 8
 class ApiController extends Controller
9 9
 {
10
-    /**
11
-     * Default Status Code.
12
-     *
13
-     * @var int
14
-     */
15
-    protected $statusCode = 200;
10
+	/**
11
+	 * Default Status Code.
12
+	 *
13
+	 * @var int
14
+	 */
15
+	protected $statusCode = 200;
16 16
 
17
-    /**
18
-     * @return int
19
-     */
20
-    public function getStatusCode()
21
-    {
22
-        return $this->statusCode;
23
-    }
17
+	/**
18
+	 * @return int
19
+	 */
20
+	public function getStatusCode()
21
+	{
22
+		return $this->statusCode;
23
+	}
24 24
 
25
-    /**
26
-     * @param int $statusCode
27
-     *
28
-     * @return $this
29
-     */
30
-    public function setStatusCode($statusCode)
31
-    {
32
-        $this->statusCode = $statusCode;
25
+	/**
26
+	 * @param int $statusCode
27
+	 *
28
+	 * @return $this
29
+	 */
30
+	public function setStatusCode($statusCode)
31
+	{
32
+		$this->statusCode = $statusCode;
33 33
 
34
-        return $this;
35
-    }
34
+		return $this;
35
+	}
36 36
 
37
-    /**
38
-     * @param array $data
39
-     *
40
-     * @return mixed
41
-     */
42
-    public function respondCreated($data, $id)
43
-    {
44
-        $headers = [
45
-            'Location' => route('api.v1.devices.show', $id),
46
-        ];
37
+	/**
38
+	 * @param array $data
39
+	 *
40
+	 * @return mixed
41
+	 */
42
+	public function respondCreated($data, $id)
43
+	{
44
+		$headers = [
45
+			'Location' => route('api.v1.devices.show', $id),
46
+		];
47 47
 
48
-        return $this->setStatusCode(201)->respond(compact('data'), $headers);
49
-    }
48
+		return $this->setStatusCode(201)->respond(compact('data'), $headers);
49
+	}
50 50
 
51
-    /**
52
-     * @param array $data
53
-     *
54
-     * @return mixed
55
-     */
56
-    public function respondPoked($data, $id)
57
-    {
58
-        $headers = [
59
-            'Location' => route('api.v1.devices.show', $id),
60
-        ];
51
+	/**
52
+	 * @param array $data
53
+	 *
54
+	 * @return mixed
55
+	 */
56
+	public function respondPoked($data, $id)
57
+	{
58
+		$headers = [
59
+			'Location' => route('api.v1.devices.show', $id),
60
+		];
61 61
 
62
-        return $this->setStatusCode(200)->respond(compact('data'), $headers);
63
-    }
62
+		return $this->setStatusCode(200)->respond(compact('data'), $headers);
63
+	}
64 64
 
65
-    /**
66
-     * @return mixed
67
-     */
68
-    public function respondNoContent()
69
-    {
70
-        return $this->setStatusCode(204)->respond([]);
71
-    }
65
+	/**
66
+	 * @return mixed
67
+	 */
68
+	public function respondNoContent()
69
+	{
70
+		return $this->setStatusCode(204)->respond([]);
71
+	}
72 72
 
73
-    /**
74
-     * @param string $message
75
-     *
76
-     * @return mixed
77
-     */
78
-    public function respondNotFound($message = 'Did not find the resource you are looking for!')
79
-    {
80
-        return $this->setStatusCode(404)->respondWithError($message);
81
-    }
73
+	/**
74
+	 * @param string $message
75
+	 *
76
+	 * @return mixed
77
+	 */
78
+	public function respondNotFound($message = 'Did not find the resource you are looking for!')
79
+	{
80
+		return $this->setStatusCode(404)->respondWithError($message);
81
+	}
82 82
 
83
-    /**
84
-     * @param $data
85
-     * @param array $headers
86
-     *
87
-     * @return mixed
88
-     */
89
-    public function respond($data, $headers = [])
90
-    {
91
-        return Response::json($data, $this->getStatusCode(), $headers);
92
-    }
83
+	/**
84
+	 * @param $data
85
+	 * @param array $headers
86
+	 *
87
+	 * @return mixed
88
+	 */
89
+	public function respond($data, $headers = [])
90
+	{
91
+		return Response::json($data, $this->getStatusCode(), $headers);
92
+	}
93 93
 
94
-    /**
95
-     * @param $message
96
-     *
97
-     * @return mixed
98
-     */
99
-    public function respondWithError($message)
100
-    {
101
-        return $this->respond([
102
-            'errors' => [
103
-                'title'  => $message,
104
-                'status' => $this->getStatusCode(),
105
-            ],
106
-        ]);
107
-    }
94
+	/**
95
+	 * @param $message
96
+	 *
97
+	 * @return mixed
98
+	 */
99
+	public function respondWithError($message)
100
+	{
101
+		return $this->respond([
102
+			'errors' => [
103
+				'title'  => $message,
104
+				'status' => $this->getStatusCode(),
105
+			],
106
+		]);
107
+	}
108 108
 }
Please login to merge, or discard this patch.
app/Http/Controllers/GroupController.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@
 block discarded – undo
6 6
 
7 7
 class GroupController extends Controller
8 8
 {
9
-    /**
10
-     * Show all Devices for the given group.
11
-     *
12
-     * @param string $group
13
-     *
14
-     * @return Response
15
-     */
16
-    public function show($group)
17
-    {
18
-        $devices = Device::where('group', $group)->get();
9
+	/**
10
+	 * Show all Devices for the given group.
11
+	 *
12
+	 * @param string $group
13
+	 *
14
+	 * @return Response
15
+	 */
16
+	public function show($group)
17
+	{
18
+		$devices = Device::where('group', $group)->get();
19 19
 
20
-        return view('overview')->with(compact('devices', 'group'));
21
-    }
20
+		return view('overview')->with(compact('devices', 'group'));
21
+	}
22 22
 }
Please login to merge, or discard this patch.
app/Http/Controllers/WelcomeController.php 2 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 class WelcomeController extends Controller
13 13
 {
14
-    /*
14
+	/*
15 15
     |--------------------------------------------------------------------------
16 16
     | Welcome Controller
17 17
     |--------------------------------------------------------------------------
@@ -22,64 +22,64 @@  discard block
 block discarded – undo
22 22
     |
23 23
     */
24 24
 
25
-    /**
26
-     * Create a new controller instance.
27
-     */
28
-    public function __construct()
29
-    {
30
-        $this->middleware('guest');
31
-    }
32
-
33
-    /**
34
-     * Show the application welcome screen to the user.
35
-     *
36
-     * @return Response
37
-     */
38
-    public function index()
39
-    {
40
-        $devices = Device::onHomePage()->get();
41
-
42
-        return view('overview')->with(compact('devices'));
43
-    }
44
-
45
-    /**
46
-     * Show the getting started screen to the user.
47
-     *
48
-     * @param MarkdownParser $markdown
49
-     * @param Cache          $cache
50
-     * @param Filesystem     $file
51
-     *
52
-     * @return Response
53
-     */
54
-    public function gettingStarted(MarkdownParser $markdown, Cache $cache, Filesystem $file)
55
-    {
56
-        $gettingStarted = $cache->remember('getting-started', 5, function () use ($markdown, $file) {
57
-
58
-            $gettingStarted = $file->get(base_path('resources/getting-started/readme.md'));
59
-
60
-            return $markdown->parse($gettingStarted);
61
-        });
62
-
63
-        return view('getting-started')->with(compact('gettingStarted'));
64
-    }
65
-
66
-    /**
67
-     * Show the statistics screen to the user.
68
-     *
69
-     * @return Response
70
-     */
71
-    public function statistics(Statistics $statistics)
72
-    {
73
-        $pokes_total = $statistics->totalPokes();
74
-
75
-        $devices_total = $statistics->totalDevices();
76
-
77
-        $pokes = $statistics->allPokes()->toArray();
78
-
79
-        $network_distribution = $statistics->networkDistribution()->toArray();
80
-
81
-        JavaScript::put(compact('pokes', 'network_distribution'));
82
-
83
-        return view('statistics')->with(compact('pokes_total', 'devices_total'));
84
-    }
25
+	/**
26
+	 * Create a new controller instance.
27
+	 */
28
+	public function __construct()
29
+	{
30
+		$this->middleware('guest');
31
+	}
32
+
33
+	/**
34
+	 * Show the application welcome screen to the user.
35
+	 *
36
+	 * @return Response
37
+	 */
38
+	public function index()
39
+	{
40
+		$devices = Device::onHomePage()->get();
41
+
42
+		return view('overview')->with(compact('devices'));
43
+	}
44
+
45
+	/**
46
+	 * Show the getting started screen to the user.
47
+	 *
48
+	 * @param MarkdownParser $markdown
49
+	 * @param Cache          $cache
50
+	 * @param Filesystem     $file
51
+	 *
52
+	 * @return Response
53
+	 */
54
+	public function gettingStarted(MarkdownParser $markdown, Cache $cache, Filesystem $file)
55
+	{
56
+		$gettingStarted = $cache->remember('getting-started', 5, function () use ($markdown, $file) {
57
+
58
+			$gettingStarted = $file->get(base_path('resources/getting-started/readme.md'));
59
+
60
+			return $markdown->parse($gettingStarted);
61
+		});
62
+
63
+		return view('getting-started')->with(compact('gettingStarted'));
64
+	}
65
+
66
+	/**
67
+	 * Show the statistics screen to the user.
68
+	 *
69
+	 * @return Response
70
+	 */
71
+	public function statistics(Statistics $statistics)
72
+	{
73
+		$pokes_total = $statistics->totalPokes();
74
+
75
+		$devices_total = $statistics->totalDevices();
76
+
77
+		$pokes = $statistics->allPokes()->toArray();
78
+
79
+		$network_distribution = $statistics->networkDistribution()->toArray();
80
+
81
+		JavaScript::put(compact('pokes', 'network_distribution'));
82
+
83
+		return view('statistics')->with(compact('pokes_total', 'devices_total'));
84
+	}
85 85
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
      */
54 54
     public function gettingStarted(MarkdownParser $markdown, Cache $cache, Filesystem $file)
55 55
     {
56
-        $gettingStarted = $cache->remember('getting-started', 5, function () use ($markdown, $file) {
56
+        $gettingStarted = $cache->remember('getting-started', 5, function() use ($markdown, $file) {
57 57
 
58 58
             $gettingStarted = $file->get(base_path('resources/getting-started/readme.md'));
59 59
 
Please login to merge, or discard this patch.
app/Http/Kernel.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@
 block discarded – undo
6 6
 
7 7
 class Kernel extends HttpKernel
8 8
 {
9
-    /**
10
-     * The application's global HTTP middleware stack.
11
-     *
12
-     * @var array
13
-     */
14
-    protected $middleware = [
15
-        'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
16
-        'Illuminate\Cookie\Middleware\EncryptCookies',
17
-        'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
18
-        'Illuminate\Session\Middleware\StartSession',
19
-        'Illuminate\View\Middleware\ShareErrorsFromSession',
20
-        'PiFinder\Http\Middleware\VerifyCsrfToken',
21
-    ];
9
+	/**
10
+	 * The application's global HTTP middleware stack.
11
+	 *
12
+	 * @var array
13
+	 */
14
+	protected $middleware = [
15
+		'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
16
+		'Illuminate\Cookie\Middleware\EncryptCookies',
17
+		'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
18
+		'Illuminate\Session\Middleware\StartSession',
19
+		'Illuminate\View\Middleware\ShareErrorsFromSession',
20
+		'PiFinder\Http\Middleware\VerifyCsrfToken',
21
+	];
22 22
 
23
-    /**
24
-     * The application's route middleware.
25
-     *
26
-     * @var array
27
-     */
28
-    protected $routeMiddleware = [
29
-        'auth'       => 'PiFinder\Http\Middleware\Authenticate',
30
-        'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
31
-        'guest'      => 'PiFinder\Http\Middleware\RedirectIfAuthenticated',
32
-    ];
23
+	/**
24
+	 * The application's route middleware.
25
+	 *
26
+	 * @var array
27
+	 */
28
+	protected $routeMiddleware = [
29
+		'auth'       => 'PiFinder\Http\Middleware\Authenticate',
30
+		'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
31
+		'guest'      => 'PiFinder\Http\Middleware\RedirectIfAuthenticated',
32
+	];
33 33
 }
Please login to merge, or discard this patch.
app/Http/Middleware/Authenticate.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -7,41 +7,41 @@
 block discarded – undo
7 7
 
8 8
 class Authenticate
9 9
 {
10
-    /**
11
-     * The Guard implementation.
12
-     *
13
-     * @var Guard
14
-     */
15
-    protected $auth;
10
+	/**
11
+	 * The Guard implementation.
12
+	 *
13
+	 * @var Guard
14
+	 */
15
+	protected $auth;
16 16
 
17
-    /**
18
-     * Create a new filter instance.
19
-     *
20
-     * @param Guard $auth
21
-     */
22
-    public function __construct(Guard $auth)
23
-    {
24
-        $this->auth = $auth;
25
-    }
17
+	/**
18
+	 * Create a new filter instance.
19
+	 *
20
+	 * @param Guard $auth
21
+	 */
22
+	public function __construct(Guard $auth)
23
+	{
24
+		$this->auth = $auth;
25
+	}
26 26
 
27
-    /**
28
-     * Handle an incoming request.
29
-     *
30
-     * @param \Illuminate\Http\Request $request
31
-     * @param \Closure                 $next
32
-     *
33
-     * @return mixed
34
-     */
35
-    public function handle($request, Closure $next)
36
-    {
37
-        if ($this->auth->guest()) {
38
-            if ($request->ajax()) {
39
-                return response('Unauthorized.', 401);
40
-            } else {
41
-                return redirect()->guest('auth/login');
42
-            }
43
-        }
27
+	/**
28
+	 * Handle an incoming request.
29
+	 *
30
+	 * @param \Illuminate\Http\Request $request
31
+	 * @param \Closure                 $next
32
+	 *
33
+	 * @return mixed
34
+	 */
35
+	public function handle($request, Closure $next)
36
+	{
37
+		if ($this->auth->guest()) {
38
+			if ($request->ajax()) {
39
+				return response('Unauthorized.', 401);
40
+			} else {
41
+				return redirect()->guest('auth/login');
42
+			}
43
+		}
44 44
 
45
-        return $next($request);
46
-    }
45
+		return $next($request);
46
+	}
47 47
 }
Please login to merge, or discard this patch.
app/Http/Middleware/RedirectIfAuthenticated.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -8,37 +8,37 @@
 block discarded – undo
8 8
 
9 9
 class RedirectIfAuthenticated
10 10
 {
11
-    /**
12
-     * The Guard implementation.
13
-     *
14
-     * @var Guard
15
-     */
16
-    protected $auth;
11
+	/**
12
+	 * The Guard implementation.
13
+	 *
14
+	 * @var Guard
15
+	 */
16
+	protected $auth;
17 17
 
18
-    /**
19
-     * Create a new filter instance.
20
-     *
21
-     * @param Guard $auth
22
-     */
23
-    public function __construct(Guard $auth)
24
-    {
25
-        $this->auth = $auth;
26
-    }
18
+	/**
19
+	 * Create a new filter instance.
20
+	 *
21
+	 * @param Guard $auth
22
+	 */
23
+	public function __construct(Guard $auth)
24
+	{
25
+		$this->auth = $auth;
26
+	}
27 27
 
28
-    /**
29
-     * Handle an incoming request.
30
-     *
31
-     * @param \Illuminate\Http\Request $request
32
-     * @param \Closure                 $next
33
-     *
34
-     * @return mixed
35
-     */
36
-    public function handle($request, Closure $next)
37
-    {
38
-        if ($this->auth->check()) {
39
-            return new RedirectResponse(url('/home'));
40
-        }
28
+	/**
29
+	 * Handle an incoming request.
30
+	 *
31
+	 * @param \Illuminate\Http\Request $request
32
+	 * @param \Closure                 $next
33
+	 *
34
+	 * @return mixed
35
+	 */
36
+	public function handle($request, Closure $next)
37
+	{
38
+		if ($this->auth->check()) {
39
+			return new RedirectResponse(url('/home'));
40
+		}
41 41
 
42
-        return $next($request);
43
-    }
42
+		return $next($request);
43
+	}
44 44
 }
Please login to merge, or discard this patch.
app/Http/Middleware/VerifyCsrfToken.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@
 block discarded – undo
7 7
 
8 8
 class VerifyCsrfToken extends BaseVerifier
9 9
 {
10
-    /**
11
-     * Handle an incoming request.
12
-     *
13
-     * @param \Illuminate\Http\Request $request
14
-     * @param \Closure                 $next
15
-     *
16
-     * @return mixed
17
-     */
18
-    public function handle($request, Closure $next)
19
-    {
20
-        // Do not perform CSRF checks for API requests
21
-        if (preg_match('#^/api#', $request->path()) !== false) {
22
-            return $next($request);
23
-        }
10
+	/**
11
+	 * Handle an incoming request.
12
+	 *
13
+	 * @param \Illuminate\Http\Request $request
14
+	 * @param \Closure                 $next
15
+	 *
16
+	 * @return mixed
17
+	 */
18
+	public function handle($request, Closure $next)
19
+	{
20
+		// Do not perform CSRF checks for API requests
21
+		if (preg_match('#^/api#', $request->path()) !== false) {
22
+			return $next($request);
23
+		}
24 24
 
25
-        return parent::handle($request, $next);
26
-    }
25
+		return parent::handle($request, $next);
26
+	}
27 27
 }
Please login to merge, or discard this patch.
app/Http/Requests/Request.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@
 block discarded – undo
6 6
 
7 7
 abstract class Request extends FormRequest
8 8
 {
9
-    public function __construct()
10
-    {
11
-        parent::__construct();
9
+	public function __construct()
10
+	{
11
+		parent::__construct();
12 12
 
13
-        $this->validateMac();
14
-    }
13
+		$this->validateMac();
14
+	}
15 15
 
16
-    public function validateMac()
17
-    {
18
-        app('validator')->extend('mac', function ($attribute, $value, $parameters) {
19
-            return preg_match('/^(([0-9a-fA-F]{2}-){5}|([0-9a-fA-F]{2}:){5})[0-9a-fA-F]{2}$/', $value);
20
-        });
21
-    }
16
+	public function validateMac()
17
+	{
18
+		app('validator')->extend('mac', function ($attribute, $value, $parameters) {
19
+			return preg_match('/^(([0-9a-fA-F]{2}-){5}|([0-9a-fA-F]{2}:){5})[0-9a-fA-F]{2}$/', $value);
20
+		});
21
+	}
22 22
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
     public function validateMac()
17 17
     {
18
-        app('validator')->extend('mac', function ($attribute, $value, $parameters) {
18
+        app('validator')->extend('mac', function($attribute, $value, $parameters) {
19 19
             return preg_match('/^(([0-9a-fA-F]{2}-){5}|([0-9a-fA-F]{2}:){5})[0-9a-fA-F]{2}$/', $value);
20 20
         });
21 21
     }
Please login to merge, or discard this patch.