ShopBillingDataVatNumberAwareTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 24
rs 10
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\DBAL\Types\Types;
8
use Doctrine\ORM\Mapping as ORM;
9
use Symfony\Component\Serializer\Annotation\Groups;
10
11
/**
12
 * Trait that implements the shop billing data vat number functionality
13
 * Used in:
14
 * <li>@see ShopBillingData</li>
15
 */
16
trait ShopBillingDataVatNumberAwareTrait
17
{
18
    /**
19
     * @ORM\Column(name="vat_number", type="string", nullable=true)
20
     *
21
     * @Groups({"admin:shop_billing_data:read"})
22
     */
23
    #[ORM\Column(name: 'vat_number', type: Types::STRING, nullable: true)]
24
    #[Groups(['admin:shop_billing_data:read'])]
25
    protected ?string $vatNumber = null;
26
27
    public function getVatNumber(): ?string
28
    {
29
        return $this->vatNumber;
30
    }
31
32
    public function setVatNumber(?string $vatNumber): void
33
    {
34
        $this->vatNumber = $vatNumber;
35
    }
36
37
    public function hasVatNumber(): bool
38
    {
39
        return is_string($this->vatNumber) && strlen($this->vatNumber) > 0;
40
    }
41
}
42