UnknownIncludedFieldsQuery   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
1
<?php
2
3
namespace Spatie\QueryBuilder\Exceptions;
4
5
use Illuminate\Http\Response;
6
7
class UnknownIncludedFieldsQuery extends InvalidQuery
8
{
9
    /** @var \Illuminate\Support\Collection */
10
    public $unknownFields;
11
12
    public function __construct(array $unknownFields)
13
    {
14
        $this->unknownFields = collect($unknownFields);
15
16
        $unknownFields = $this->unknownFields->implode(', ');
17
18
        $message = "Requested field(s) `{$unknownFields}` are not allowed (yet). ";
19
        $message .= "If you want to allow these fields, please make sure to call the QueryBuilder's `allowedFields` method before the `allowedIncludes` method.";
20
21
        parent::__construct(Response::HTTP_BAD_REQUEST, $message);
22
    }
23
}
24