Passed
Pull Request — main (#54)
by
unknown
09:29
created

Component::parameterName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace NotificationChannels\WhatsApp\Component;
4
5
abstract class Component
6
{
7
    protected ?string $parameterName = null;
8
9
    public function parameterName(string $name): self
10
    {
11
        $this->parameterName = $name;
12
13
        return $this;
14
    }
15
16
    protected function buildParameterArray(array $baseArray): array
17
    {
18
        if ($this->parameterName !== null) {
19
            $baseArray['parameter_name'] = $this->parameterName;
20
        }
21
22
        return $baseArray;
23
    }
24
25
    abstract public function toArray(): array;
26
}
27