Passed
Push — master ( 321949...ce4224 )
by Richard
08:49 queued 14s
created

LiveContentController::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Riclep\Storyblok\Http\Controllers;
4
5
use IvoPetkov\HTML5DOMDocument;
6
use Riclep\Storyblok\StoryblokFacade as StoryBlok;
7
use Illuminate\Http\Request;
8
9
class LiveContentController
10
{
11
    public function show(Request $request, $slug = '/') {
0 ignored issues
show
Unused Code introduced by
The parameter $slug is not used and could be removed. ( Ignorable by Annotation )

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

11
    public function show(Request $request, /** @scrutinizer ignore-unused */ $slug = '/') {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
		config(['storyblok.edit_mode' => true]);
13
14
		$page = Storyblok::setData($request->get('data')['story'])->render();
0 ignored issues
show
Bug introduced by
The method setData() 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

14
		$page = Storyblok::/** @scrutinizer ignore-call */ setData($request->get('data')['story'])->render();
Loading history...
15
		$dom = new HTML5DOMDocument();
16
		$dom->loadHTML($page);
17
18
		return $dom->querySelector(config('storyblok.live-element'))->innerHTML;
19
	}
20
}
21