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

FeedController::getFeedConfiguration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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