ShopBillingDataVatNumberAwareTrait::hasVatNumber()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 1
nc 2
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 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