GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PropertyBuilder::build()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Spatie\IcalendarGenerator\Builders;
4
5
use Spatie\IcalendarGenerator\PropertyTypes\PropertyType;
6
7
final class PropertyBuilder
8
{
9
    /** @var \Spatie\IcalendarGenerator\PropertyTypes\PropertyType */
10
    private $property;
11
12
    public function __construct(PropertyType $property)
13
    {
14
        $this->property = $property;
15
    }
16
17
    public function build(): array
18
    {
19
        $parameters = $this->resolveParameters();
20
21
        $value = $this->property->getValue();
22
23
        return array_map(function (string $name) use ($value, $parameters) {
24
            return "{$name}{$parameters}:{$value}";
25
        }, $this->property->getNames());
26
    }
27
28
    private function resolveParameters(): string
29
    {
30
        $parameters = '';
31
32
        foreach ($this->property->getParameters() as $parameter) {
33
            /** @var \Spatie\IcalendarGenerator\PropertyTypes\Parameter $parameter */
34
            $name = $parameter->getName();
35
            $value = $parameter->getValue();
36
37
            $parameters .= ";{$name}={$value}";
38
        }
39
40
        return $parameters;
41
    }
42
}
43