Completed
Push — master ( d9d1e2...b73c31 )
by Ruben
01:14
created

LinkType::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\LinkTypes;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Support\Arr;
7
8
abstract class LinkType
9
{
10
    /** @var array */
11
    protected $parameters = [];
12
13
    /** @var string|null */
14
    protected $prefix;
15
16
    /** @var string|null */
17
    protected $serializer;
18
19
    abstract public function getLinks(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 serializer(?string $serializer)
38
    {
39
        $this->serializer = $serializer;
40
41
        return $this;
42
    }
43
}
44