Completed
Push — master ( 9038ff...55d9a6 )
by Sebastian
03:06 queued 11s
created

FeedController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 12 1
1
<?php
2
3
namespace Spatie\Feed\Http;
4
5
use Spatie\Feed\Feed;
6
7
class FeedController
8
{
9
    public function __invoke()
10
    {
11
        $feeds = config('feed.feeds');
12
13
        $name = str_after(app('router')->currentRouteName(), 'feeds.');
14
15
        $feed = $feeds[$name] ?? null;
16
17
        abort_unless($feed, 404);
18
19
        return new Feed($feed['title'], request()->url(), $feed['items']);
20
    }
21
}
22