Passed
Branch 1.4 (47c6b6)
by G
04:43
created

ShopBillingDataVatNumberAwareTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
dl 0
loc 22
rs 10
c 1
b 0
f 1
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setVatNumber() 0 3 1
A hasVatNumber() 0 3 2
A getVatNumber() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewebe\SyliusVATPlugin\Entity;
6
7
use Doctrine\ORM\Mapping as ORM;
8
use Symfony\Component\Serializer\Annotation\Groups;
9
10
/**
11
 * Trait that implements the shop billing data vat number functionality
12
 * Used in:
13
 * <li>@see ShopBillingData</li>
14
 */
15
trait ShopBillingDataVatNumberAwareTrait
16
{
17
    /**
18
     * @ORM\Column(name="vat_number", type="string", nullable=true)
19
     *
20
     * @Groups({"admin:shop_billing_data:read"})
21
     */
22
    protected ?string $vatNumber = null;
23
24
    public function getVatNumber(): ?string
25
    {
26
        return $this->vatNumber;
27
    }
28
29
    public function setVatNumber(?string $vatNumber): void
30
    {
31
        $this->vatNumber = $vatNumber;
32
    }
33
34
    public function hasVatNumber(): bool
35
    {
36
        return is_string($this->vatNumber) && strlen($this->vatNumber) > 0;
37
    }
38
}
39