NotifierController   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 23
c 0
b 0
f 0
wmc 7
lcom 0
cbo 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B index() 0 14 7
1
<?php namespace Cornford\Notifier\Controllers;
2
3
use App\Http\Controllers\Controller as BaseController;
4
use Illuminate\Support\Facades\Request;
5
use Illuminate\Support\Facades\Response;
6
use Cornford\Notifier\Facades\NotifierFacade as Notifier;
7
use Illuminate\Support\Facades\Route;
8
9
class NotifierController extends BaseController {
10
11
	/**
12
	 * Display a listing of the resource.
13
	 *
14
	 * @return Response
15
	 */
16
	public function index()
17
	{
18
		if ((Request::ajax() && Route::is('notifier.index')) || !Request::ajax()) {
19
			Notifier::expireDisplayedNotifications();
20
		}
21
22
		$notifications = Notifier::getDisplayNotifications();
23
24
		if ((Request::ajax() && Route::is('notifier.index')) || !Request::ajax()) {
25
			Notifier::displayNotifications($notifications);
26
		}
27
28
		return Response::json(['notifications' => Notifier::toArray($notifications)]);
29
	}
30
31
}