EmbedController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 10
c 1
b 1
f 0
dl 0
loc 15
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 1
1
<?php
2
3
namespace Djoudi\LaravelH5p\Http\Controllers;
4
5
use App\Http\Controllers\Controller;
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Controller was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Djoudi\LaravelH5p\Events\H5pEvent;
7
use Illuminate\Http\Request;
8
use Illuminate\Support\Facades\App;
9
10
class EmbedController extends Controller
11
{
12
    public function __invoke(Request $request, $id)
13
    {
14
        $h5p = App::make('LaravelH5p');
15
        $core = $h5p::$core;
0 ignored issues
show
Unused Code introduced by
The assignment to $core is dead and can be removed.
Loading history...
16
        $settings = $h5p::get_editor();
17
        $content = $h5p->get_content($id);
18
        $embed = $h5p->get_embed($content, $settings);
19
        $embed_code = $embed['embed'];
20
        $settings = $embed['settings'];
21
22
        event(new H5pEvent('content', null, $content['id'], $content['title'], $content['library']['name'], $content['library']['majorVersion'], $content['library']['minorVersion']));
0 ignored issues
show
Unused Code introduced by
The call to Djoudi\LaravelH5p\Events\H5pEvent::__construct() has too many arguments starting with $content['library']['minorVersion']. ( Ignorable by Annotation )

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

22
        event(/** @scrutinizer ignore-call */ new H5pEvent('content', null, $content['id'], $content['title'], $content['library']['name'], $content['library']['majorVersion'], $content['library']['minorVersion']));

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
23
24
        return view('h5p.content.embed', compact('settings', 'user', 'embed_code'));
25
    }
26
}
27