StoryblokController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
c 0
b 0
f 0
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 3 1
A destroy() 0 6 2
1
<?php
2
3
namespace Riclep\Storyblok\Http\Controllers;
4
5
use Illuminate\Support\Facades\Cache;
6
use Riclep\Storyblok\StoryblokFacade as StoryBlok;
7
8
class StoryblokController
9
{
10
	/**
11
	 * Loads a story rendering the content in the matched view.
12
	 *
13
	 * @param string $slug
14
	 * @return \Illuminate\View\View
15
	 * @throws \Exception
16
	 */
17
	public function show($slug = 'home'): \Illuminate\View\View
18
	{
19
		return Storyblok::read($slug)->render();
0 ignored issues
show
Bug introduced by
The method read() does not exist on Riclep\Storyblok\StoryblokFacade. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
		return Storyblok::/** @scrutinizer ignore-call */ read($slug)->render();
Loading history...
20
	}
21
22
	/**
23
	 * Deletes the cached API responses
24
	 */
25
	public function destroy(): void
26
	{
27
		if (Cache::getStore() instanceof \Illuminate\Cache\TaggableStore) {
28
			Cache::tags('storyblok')->flush();
29
		} else {
30
			Cache::flush();
31
		}
32
	}
33
}
34