Completed
Push — master ( faabfa...8c6fba )
by Joachim
22:22 queued 07:23
created

ManufacturerTrait::setConsignment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Loevgaard\DandomainConsignment\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Loevgaard\DandomainStock\Entity\Generated\StockMovementInterface;
7
8
trait ManufacturerTrait
9
{
10
    /**
11
     * @var boolean
12
     *
13
     * @ORM\Column(type="boolean")
14
     */
15
    protected $consignment = false;
16
17
    /**
18
     * @var string|null
19
     *
20
     * @ORM\Column(type="string", nullable=true, length=191)
21
     */
22
    protected $consignmentClass;
23
24
    /**
25
     * This is the last stock movement used in reports
26
     * This implies that stock movements can't be changed
27
     *
28
     * @var StockMovementInterface|null
29
     *
30
     * @ORM\ManyToOne(targetEntity="Loevgaard\DandomainStock\Entity\StockMovement")
31
     */
32
    protected $consignmentLastStockMovement;
33
34
    /**
35
     * @return bool
36
     */
37
    public function isConsignment(): bool
38
    {
39
        return (bool)$this->consignment;
40
    }
41
42
    /**
43
     * @param bool $consignment
44
     * @return ManufacturerTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type ManufacturerTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
45
     */
46
    public function setConsignment(bool $consignment)
47
    {
48
        $this->consignment = $consignment;
49
        return $this;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getConsignmentClass(): ?string
56
    {
57
        return $this->consignmentClass;
58
    }
59
60
    /**
61
     * @param string|null $consignmentClass
62
     * @return ManufacturerTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type ManufacturerTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
63
     */
64
    public function setConsignmentClass(?string $consignmentClass)
65
    {
66
        $this->consignmentClass = $consignmentClass;
67
        return $this;
68
    }
69
70
    /**
71
     * @return StockMovementInterface|null
72
     */
73
    public function getConsignmentLastStockMovement(): ?StockMovementInterface
74
    {
75
        return $this->consignmentLastStockMovement;
76
    }
77
78
    /**
79
     * @param StockMovementInterface|null $consignmentLastStockMovement
80
     * @return ManufacturerTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type ManufacturerTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
81
     */
82
    public function setConsignmentLastStockMovement(?StockMovementInterface $consignmentLastStockMovement)
83
    {
84
        $this->consignmentLastStockMovement = $consignmentLastStockMovement;
85
        return $this;
86
    }
87
}