Completed
Push — master ( b01d16...d9d1e2 )
by Ruben
03:30
created

EndpointType::prefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Spatie\ResourceLinks\EndpointTypes;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Support\Arr;
7
8
abstract class EndpointType
9
{
10
    /** @var array */
11
    protected $parameters = [];
12
13
    /** @var string|null */
14
    protected $prefix;
15
16
    /** @var string|null */
17
    protected $formatter;
18
19
    abstract public function getEndpoints(Model $model = null): array;
20
21
    public function parameters(...$parameters)
22
    {
23
        foreach ($parameters as $parameter){
24
            $this->parameters = array_merge($this->parameters, Arr::wrap($parameter));
25
        }
26
27
        return $this;
28
    }
29
30
    public function prefix(?string $prefix)
31
    {
32
        $this->prefix = $prefix;
33
34
        return $this;
35
    }
36
37
    public function formatter(?string $formatter)
38
    {
39
        $this->formatter = $formatter;
40
41
        return $this;
42
    }
43
}
44