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

Component   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 21
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parameterName() 0 5 1
A buildParameterArray() 0 7 2
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