Issues (115)

src/Resources/ResourceIdentifierCollection.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace VGirol\JsonApi\Resources;
4
5
use Illuminate\Http\Request;
6
use VGirol\JsonApiConstant\Members;
7
8
class ResourceIdentifierCollection extends BaseResourceCollection
9
{
10
    use IsData;
11
    use IsRelationship;
12
13
    public function __construct($resource)
14
    {
15
        parent::__construct($resource);
16
17
        $this->wrap(Members::DATA);
18
    }
19
20
    /**
21
     * Get any additional data that should be returned with the resource array.
22
     *
23
     * @param  Request  $request
24
     * @return array
25
     */
26
    public function with($request)
27
    {
28
        $this->addDocumentLink(Members::LINK_SELF, $this->getDocumentSelfLink($request));
0 ignored issues
show
$request of type Illuminate\Http\Request is incompatible with the type Illuminate\Support\Facades\Request expected by parameter $request of VGirol\JsonApi\Resources...::getDocumentSelfLink(). ( Ignorable by Annotation )

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

28
        $this->addDocumentLink(Members::LINK_SELF, $this->getDocumentSelfLink(/** @scrutinizer ignore-type */ $request));
Loading history...
29
        $this->addDocumentLink(Members::LINK_RELATED, $this->getDocumentRelatedLink($request));
0 ignored issues
show
$request of type Illuminate\Http\Request is incompatible with the type Illuminate\Support\Facades\Request expected by parameter $request of VGirol\JsonApi\Resources...etDocumentRelatedLink(). ( Ignorable by Annotation )

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

29
        $this->addDocumentLink(Members::LINK_RELATED, $this->getDocumentRelatedLink(/** @scrutinizer ignore-type */ $request));
Loading history...
30
31
        // if (jsonapiPagination()->allowed($request)) {
32
        //     if ($this->isRelationship()) {
33
        //         if ($this->hasToManyResults()) {
34
        //             $this->addToMeta('total_items', $this->resource->count());
35
        //         }
36
        //     } else {
37
        //         $this->addToMeta('pagination', jsonapiPagination()->getPaginationMeta());
38
39
        //         foreach (jsonapiPagination()->getPaginationLinks() as $name => $url) {
40
        //             $this->addToLinks($name, $url);
41
        //         }
42
        //     }
43
        // }
44
45
        return $this->with;
46
    }
47
}
48