Subscription::getSubscriptionId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * You can find more information about us on https://bitbag.io and write us
7
 * an email on [email protected].
8
 */
9
10
declare(strict_types=1);
11
12
namespace BitBag\SyliusMolliePlugin\Entity;
13
14
use Sylius\Component\Core\Model\OrderInterface;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, BitBag\SyliusMolliePlugin\Entity\OrderInterface. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
15
16
class Subscription implements SubscriptionInterface
17
{
18
    /** @var int|null */
19
    protected $id;
20
21
    /** @var OrderInterface */
22
    protected $order;
23
24
    /** @var string|null */
25
    protected $subscriptionId;
26
27
    /** @var string|null */
28
    protected $customerId;
29
30
    /** @var string */
31
    protected $state = SubscriptionInterface::STATE_NEW;
32
33
    public function getId(): ?int
34
    {
35
        return $this->id;
36
    }
37
38
    public function getOrder(): OrderInterface
39
    {
40
        return $this->order;
41
    }
42
43
    public function setOrder(OrderInterface $order): void
44
    {
45
        $this->order = $order;
46
    }
47
48
    public function getSubscriptionId(): ?string
49
    {
50
        return $this->subscriptionId;
51
    }
52
53
    public function setSubscriptionId(?string $subscriptionId): void
54
    {
55
        $this->subscriptionId = $subscriptionId;
56
    }
57
58
    public function getState(): string
59
    {
60
        return $this->state;
61
    }
62
63
    public function setState(string $state): void
64
    {
65
        $this->state = $state;
66
    }
67
68
    public function getCustomerId(): ?string
69
    {
70
        return $this->customerId;
71
    }
72
73
    public function setCustomerId(?string $customerId): void
74
    {
75
        $this->customerId = $customerId;
76
    }
77
}
78