Completed
Push — master ( 8c6fba...a0f193 )
by Joachim
12:56
created

ManufacturerTrait::setConsignmentClass()   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
     * This is the last stock movement used in reports
19
     * This implies that stock movements can't be changed
20
     *
21
     * @var StockMovementInterface|null
22
     *
23
     * @ORM\ManyToOne(targetEntity="Loevgaard\DandomainStock\Entity\StockMovement")
24
     */
25
    protected $consignmentLastStockMovement;
26
27
    /**
28
     * @return bool
29
     */
30
    public function isConsignment(): bool
31
    {
32
        return (bool)$this->consignment;
33
    }
34
35
    /**
36
     * @param bool $consignment
37
     * @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...
38
     */
39
    public function setConsignment(bool $consignment)
40
    {
41
        $this->consignment = $consignment;
42
        return $this;
43
    }
44
45
    /**
46
     * @return StockMovementInterface|null
47
     */
48
    public function getConsignmentLastStockMovement(): ?StockMovementInterface
49
    {
50
        return $this->consignmentLastStockMovement;
51
    }
52
53
    /**
54
     * @param StockMovementInterface|null $consignmentLastStockMovement
55
     * @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...
56
     */
57
    public function setConsignmentLastStockMovement(?StockMovementInterface $consignmentLastStockMovement)
58
    {
59
        $this->consignmentLastStockMovement = $consignmentLastStockMovement;
60
        return $this;
61
    }
62
}