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

ShopBillingDataVatNumberAwareTrait::hasVatNumber()   A

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\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