Issues (115)

src/Resources/HasIdentification.php (2 issues)

1
<?php
2
3
namespace VGirol\JsonApi\Resources;
4
5
use Illuminate\Http\Request;
6
use VGirol\JsonApiConstant\Members;
7
8
trait HasIdentification
9
{
10
    public function getId()
11
    {
12
        return is_null($this->resource) ? null : $this->resource->getKey();
13
    }
14
15
    /**
16
     * Undocumented function
17
     *
18
     * @param Request $request
19
     *
20
     * @return void
21
     */
22
    protected function setIdentification($request)
0 ignored issues
show
The parameter $request 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

22
    protected function setIdentification(/** @scrutinizer ignore-unused */ $request)

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...
23
    {
24
        $this->setResourceIdentification([
0 ignored issues
show
It seems like setResourceIdentification() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

24
        $this->/** @scrutinizer ignore-call */ 
25
               setResourceIdentification([
Loading history...
25
            Members::TYPE => $this->aliases->getResourceType(get_class($this->resource)),
26
            Members::ID => (string) $this->getId()
27
        ]);
28
    }
29
}
30