Completed
Push — master ( 0d687f...b9980e )
by Jeremy
06:24
created

SoundServices   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSound() 0 7 2
1
<?php
2
3
namespace App\Services;
4
5
use App\Models\Sound;
6
7
class SoundServices
8
{
9
    /**
10
     * Get the Sounds from Database
11
     *
12
     * @param  int $id      Sound Id
13
     *
14
     * @return Collection   The Sound
0 ignored issues
show
Bug introduced by
The type App\Services\Collection 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...
15
     */
16
    public static function getSound($id)
17
    {
18
        if (!$id) {
19
            return abort(404);
0 ignored issues
show
Bug Best Practice introduced by
The expression return abort(404) returns the type void which is incompatible with the documented return type App\Services\Collection.
Loading history...
Bug introduced by
Are you sure the usage of abort(404) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
20
        }
21
22
        return Sound::findOrFail($id);
0 ignored issues
show
Bug Best Practice introduced by
The expression return App\Models\Sound::findOrFail($id) returns the type App\Models\Sound which is incompatible with the documented return type App\Services\Collection.
Loading history...
23
    }
24
}